Alteryx Designer Desktop Discussions

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

Formula: tried to apply string operator to a numeric value

Jimmylee4real
8 - Asteroid

Hi Alteryx experts,

 

First of all, I hope everyone is doing well and safe from the COVID-19. I am new to Alteryx and need some help with the formula tools to set some certain criteria for an output. 

 

I am trying to find multiple criteria across two columns and if it can output "ABC2" in column A

 

An example is: if the time is >=22 or <8 or it shows "Y" in weekend column, then it will automatically fill in "ABC2" for type column

 

Is the expression below correct? Looks like the it is throwing my output off due to the "tried to apply string operator to a numeric value error"

 

IF Contains([Time], ">=22") or Contains([Time], "< 8") or Contains([Weekend], "Y")

THEN [Type],"ABC2" ELSE Null()ENDIF

 

Appreciate if you gurus can guide, how to achieve this.

 

Regards

5 REPLIES 5
AbhilashR
15 - Aurora
15 - Aurora

Hi @Jimmylee4real, try setting up your formula as

 

IF TONUMBER([Time]) >=22 
	or TONUMBER([Time]) < 8
	or Contains([Weekend], "Y")
THEN "ABC2" ELSE Null()
ENDIF

 

AbhilashR_0-1594871508765.png

 

 

Let us know if this doesn't resolve the error.

Jimmylee4real
8 - Asteroid

hello AbhilashR, 

 

thanks for the solution and one more step to go.

 

After using your formula, all the previous records on column "Type" has also changed into ABC2. Is it possible to set a formula to change on null values only with the criteria while all the previous records remain the same? 

 

thank you so much 

Jimmylee4real
8 - Asteroid

Let me try to make it abit more clear here: 

when the "time" column is "null", i want the type column to remain the same.

T_Willins
14 - Magnetar
14 - Magnetar

Hi @Jimmylee4real,

 

Modify the formula by adding IF IsNull([Time]) THEN [Type] ELSEIF to the beginning of your formula in place of the initial IF:

 

IF IsNull([Time]) THEN [Type] ELSEIF ToNumber([Time]) >=22 OR ToNumber([Time]) < 8 OR Contains([Weekend], "Y") THEN "ABC2 ELSE Null() ENDIF

 

 

Jimmylee4real
8 - Asteroid

thank you so much for assistance and kindness! 

 

btw is it possible to create a pivot table in Alteryx? 

 

What is equivalent to "filters", "values" and "rows" in Alteryx? thanks once again 

Labels