Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!
Free Trial

Forum - Deutsch

Suchen Sie nach Antworten, stellen Sie Fragen und teilen Sie Ihr Alteryx-Wissen.
GELÖST

contain Matching over several ines

MichaelHa
Atom

Hello everybody,

 

I ran into a problem where I'm unfortunately currently stuck. Maybe the community can help me here. I would like to create a matching over several lines with the contains function. For example:

 

Input:

Fruitstotaltext
Apple5Apples tastes great with pears
pear1Pears  tastes great with apples
strawberry7Strawberrys tastes great with cherrys
orange3Oranges tastes great with limes
cherry6Cherrys tastes great with strawberrys
lime6Limes tastes great with oranges

 

Output:

Fruitstotaltextfruits Matchtotal
Apple5Apples tastes great with pearspear1
pear1Pears  tastes great with applesApple5
strawberry7Strawberrys tastes great with cherryscherry6
orange3Oranges tastes great with limeslime6
cherry6Cherrys tastes great with strawberrysstrawberry7
lime6Limes tastes great with orangesorange3

 

Thanks,

Michael

5 ANTWORTEN 5
reply_mueller
Asteroid

Hello @MichaelHa ,

 

this is in fact very easy in Alteryx. What you have to do is compare every target "fruit" with every text line, to do so, a so called cross-product of the inputs has to be built.
This can be easily done, using the Append Fields tool, by using the same input for Source and Target.

 

Afterwards you just filter out the matching lines... and voilà:

reply_mueller_0-1617000763671.png

 

Configure the Append Fields tool to allow for all sizes of Target records.
CAREFUL: This creates an output of input-size^2, so this can become huge for large inputs:

 

reply_mueller_1-1617000798232.png

 

Make sure to also filter out those lines where the "Fruit" matches the "fruit Match" to avoid wrong results:

reply_mueller_2-1617000813265.png

 

P.S. dadurch, dass es sich bei diesem Forum um die deutsche Alteryx Community handelt können wir auch gerne Deutsch sprechen.

Viele Grüße

Johannes
(Blue Reply)

grossal
15 - Aurora
15 - Aurora

Hello @MichaelHa,

 

welcome to the Alteryx Community and the German Forum! If you are able to, feel free to make your next post in German 😉

 

Thank you @reply_mueller for looking at it.

 

 

Best

Alex

MichaelHa
Atom

Danke für den schnellen Lösungsvorschlag! Es ist aber mit einem Datensatz von mehr als 300.000 Zeilen nicht machbar.

reply_mueller
Asteroid

Hallo @MichaelHa ,

 

du kannst die Größe der zu matchenden Daten natürlich verringern, wenn du vor den Target-Anker ein Sample-, oder Unique-Tool  einfügst, dann schrumpft die Größe des resultierenden Datensatzes auf #(eingabezeilen) * #(suchterme) und diese Anzahl der Vergleiche brauchst du ja im Endeffekt auch. Alteryx ist releativ fix, was das verarbeiten großer Datenmengen betrifft. Give it a go.

 

So sähe es dann in dem optimierten Fall aus:

reply_mueller_0-1617025026959.png


Eine andere Möglichkeit wäre es, dynamisch aus diesen Suchtermen eine komplexe RegEx zu erstellen und mit dieser die ursprüngliche Tabelle zu matchen.

Ob das allerdings große Geschwindigkeitsvorteile mit sich bringt, müsste man testen.


Viele Grüße

Johannes
(Blue Reply)

StephV
Alteryx Alumni (Retired)

Hallo @MichaelHa,

 

vielen Dank, dass Sie die Antwort von als Lösung akzeptiert haben.

 

Es freut mich zu sehen, dass die deutsche Community (Danke @reply_mueller 😎) Ihnen helfen konnte.

Werden Sie morgen an der User Group teilnehmen?

 

Viel Spaß mit Alteryx, bei Fragen sind wir hier im Forum immer gerne für dich da.

 

Einen schönen Tag,

Steph Vitale-Havreng
Beschriftungen