Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

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

Simple formula question

Miki2021
8 - Asteroid

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!
 

15 REPLIES 15
AngelosPachis
16 - Nebula

Hi @Miki2021 ,

 

Your logic appears to be working for me, so maybe there is another error in the workflow?

 

AngelosPachis_0-1609676358139.png

 

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

 

Qiu
21 - Polaris
21 - Polaris

@Miki2021 
I think we can use RegEx '\D' to tell any non-digit characters.

0103-Miki2021.PNG

Miki2021
8 - Asteroid

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.  

Miki2021
8 - Asteroid

I believe the empty cell (even contains no text) in column A is also considered "string". Maybe I should make it "null" first?

 

 

Qiu
21 - Polaris
21 - Polaris

@Miki2021 
I think my workflow can handle that.

And it would be better you could provide more test cases.

 

Qiu_0-1609677802487.png

 

AngelosPachis
16 - Nebula

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.

AngelosPachis_0-1609677751315.png

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.

 

AngelosPachis_1-1609677915702.png

 

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.

AngelosPachis_2-1609677925613.png

 

Even if you have numeric values in there, but the field was again a string, that will again return "Website"

 

AngelosPachis_3-1609678013767.png

 

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?

 

 

 

 

 

Miki2021
8 - Asteroid

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). 

AngelosPachis
16 - Nebula

What version are you on?

Miki2021
8 - Asteroid

@AngelosPachis 

 

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?

Labels
Top Solution Authors