Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

if within a filter

lliberm1
7 - Meteor

i have a filter that looks to see if a field contains both the strings "EUR" and "USD" (as in various pairs of currencies).  however, some fields will also have "European" in the name (which doesnt refer to the currency EUR) along with the pair of currencies.  so i may have European EUR/USD (works fine since its picking up EUR regardless) or European INR/USD (will fail since its picking up EUR in European to create EUR/INR as the output when it should be INR/USD, or INR/USD (which is fine since European isnt included to mess the filter up) or EUR/USD (which is fine regardless if european was included).

 

I want to avoid the unintended filtering due to European in the name.

 

The things i have thought of...

1) is there a way to see if a field contains "EUR" two times in a filter?

2) is there a way to include an if then into the filter (if string contains European do one thing but if not, do another)

3) changing the ordering of the filters may be a work around as i can put the EUR pairs last so it would see USD/INR first and filter that out before it looks for EUR/XXX.

4) possibly removing European from the field prior to the sort (but not sure how that works either)

 

I dont want to filter to find European first as i would have to create two separate massive workflows off of each of the true and false legs.

 

Thanks,

5 REPLIES 5
DavidP
17 - Castor
17 - Castor

A regex expression in the filter condition will help you here.  The more complex the pattern you're looking to isolate, the more regexing it will need. In the simplest case where you're trying to isolate these pairs: EUR/USD and USD/EUR, the following will work.

 

But if you have different scenarios that you need to catch, you'll need a bit more regex.

 

Example attached.

 

Untitled.png

danilang
19 - Altair
19 - Altair

Hi @lliberm1 

 

If you know that your currencies are always in capitals and the other words aren't, you can use the CaseInsensitive switch in the Contains command

 

Contains([Field1],"EUR",0) and Contains([Field1],"USD",0)

 

Dan 

lliberm1
7 - Meteor

everything is in caps so that wont work.

lliberm1
7 - Meteor

the EUR and USD may not always be separate by "/"

lliberm1
7 - Meteor

i used regex to remove European from the field as that is the easiest workaround for now.  Thanks all.

Labels