Alteryx Designer Desktop Discussions

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

Test

Sifiso
8 - Asteroid

Hi all 

 

I have a field that has a pattern like this (the first word is followed by a comma).

 

1. Blue, this is my favourite colour, it is a royal colour and my boys also like blue.

2. Black, this colour is associated with darkness, bad luck and hardships. 

3. Green, this colour is represents nature, green light and positivity.

4. Machine learning is very difficult.

5. Finance is my favourite subject.

 

I want to write a formula if the first word is followed by a comma then null

 

expected output:

1. Null

2. Null

3. Null

4. Machine learning is very difficult.

5. Finance is my favourite subject.

6 REPLIES 6
Deano478
12 - Quasar

hey @Sifiso you can use the formula:

if Contains([Input], ',') Then Null() else [Input] endif

 just repalace Input with our column name

 

JamesCharnley
13 - Pulsar

Hi @Sifiso 

 

If contains([FieldName],',') then Null() else [FieldName] endif

 

should work, checking for a comma and nulling if it's present, but leaving it as it is if not.

 

Edit:If there's a chance you sometimes want to keep something that has a comma in, there's a string function called EndsWith that would work also. If EndsWith([FieldName],',') then null() else [FieldName] endif

Sifiso
8 - Asteroid

Hi. thanks for the quick response. I have updated the post (I think it was a bit misleading). there is multiple commas in each sentence but I want the logic that will take care of the comma after the first word.

Deano478
12 - Quasar

@Sifiso what should the corresponding output now look like?

Sifiso
8 - Asteroid

1. Null

2. Null

3. Null

4. Machine learning is very difficult.

5. Finance is my favourite subject.

JamesCharnley
13 - Pulsar

Hi @Sifiso 

 

Difficult to be 100% sure what will work without seeing the full data set, but if it's always 1 word and then a comma that we want as null(), then I'd expect something like the following will work:

 

image.png

Labels