Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Value of 520 not being matched properly in one workflow vs. another

erinlwhaley
5 - Atom

I have 2 different workflows where I am using the same formula but in one it is working for the value 520 and the other it isn't. And in both all the other numeric-like values are working EXCEPT for 520 in the 2nd workflow. Noticing now that my list ordering in the formulas is different where the 520 is before the other values in the one where it isn't working...hmmm.

 

Workflow 1:

IF [MSA_Code] in ("1920","2080","5000","3600","3640", "520","5600","5640","7600","7040","8280","8840") THEN 1 ELSE 0 ENDIF

 

 

Workflow 2:

if [MSA_Code] in ("520","1920","2080","3600","5000","5600","7600","7040","8280","8840") then 1
elseif [MSA_Code]="520" then 1
else 0 endif

 

Would the format of V_String vs. V_Wstring make a difference? I notice when viewing the CSV output in Excel that in #1 it sorts like a string, where 520 comes after 5100, but in #2 it sorts like a number where 520 comes before 5100. 

 

But if formatting were the issue, wouldn't it affect all the other values and not just 520? 

6 REPLIES 6
Luke_C
17 - Castor
17 - Castor

Can you share a sample csv? Are you sure there's no special characters at play? Try pasting into the below site and seeing if anything looks weird:

What Unicode character is this ?

erinlwhaley
5 - Atom

Also, in #1 [MSA_Code] is formatted as V_String and in #2 it is formatted as V_WString 

erinlwhaley
5 - Atom

When I post values from both #1 and #2, they both show the same:

 

U+0035 : DIGIT FIVE
U+0032 : DIGIT TWO
U+0030 : DIGIT ZERO

binuacs
21 - Polaris

@erinlwhaley Can you try the below if condition

IF toNumber([MSA_Code]) IN (1920,2080,5000,3600,3640, 520,5600,5640,7600,7040,8280,8840) THEN 1 ELSE 0 ENDIF


if toNumber([MSA_Code]) in (520,1920,2080,3600,5000,5600,7600,7040,8280,8840) then 1
elseif toNumber([MSA_Code])=520 then 1
else 0 endif
erinlwhaley
5 - Atom

this worked! not clear why it needs to be used, but its OK - I will use it. Thanks!!

apathetichell
19 - Altair

I guess it doesn't hurt to suggest - "do you have AMP on? Try turning it off." basically order should not matter with IN, so unless one of your 520's has an extra space or is using some weird character set- your two statements should be identical.

Labels