Hi there,
I'm trying to segment the sales channel raw data by creating a very simple formula on Alteryx.
The logic goes like this:
If column A contains text, the sales channel = "Website"
If column B contains text, the sales channel = "Mobile App"
Else, the rest is "Shop"
Originally I tried to use a conditional formula (IF xx THEN xx ELSEIF xx THEN xx ELSE xx ENDIF), but learnt that I cannot set the condition with IsString formula. Appreciate any suggestions from the bright minds here.
Cheers!
Solved! Go to Solution.
Hi @Miki2021 ,
Your logic appears to be working for me, so maybe there is another error in the workflow?
In the Sales Channel, I got "Website" because both columns A and B contain a string but statement for column A is read first, and since it's true alteryx exits the If statement.
Maybe we should come up with a more robust logic, in case both columns A and B are populated simultaneously? If you are sure that's never the case then no need to worry. What kind of error did you get when you typed your If statement?
Regards,
Angelos
@Miki2021
I think we can use RegEx '\D' to tell any non-digit characters.
Thanks indeed for your prompt reply!
I tried it, and somehow all results show "Website". Indeed all the columns are string, so I was also trying to figure out what went wrong.
I believe the empty cell (even contains no text) in column A is also considered "string". Maybe I should make it "null" first?
@Miki2021
I think my workflow can handle that.
And it would be better you could provide more test cases.
Hi @Miki2021 ,
I tried both Null and Empty and in both instances it seems that the logical function IsString was True, so Sales Channel was website.
Apparently the "IsString" logical function is checking whether the field type is a string and not the individual records within that field. That explains why even if you have Null or Empty values, you still get "Website" as an answer.
If you check the metadata, then both A and B have a type of String, and that's what causes the logical function IsString to be true.
Even if you have numeric values in there, but the field was again a string, that will again return "Website"
So maybe we should come up with an alternative logic to check the values in fields A and B. Can you tell us more about the values in those two fields, or maybe share a mock dataset that we can base our theory on?
I tried to use this formula, too, but is it true that I need an upgraded version of Alteryx coz I failed to select the column name (only constants can be selected).
What version are you on?
I tried to upload a sample file here and see if that gives some more clues?
Is there any other formula (except Isstring) that can define if the cell contains text regardless of numeric value or string value?