Alteryx Designer Desktop Discussions

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

"Malformed IF STATEMENT"

giadagiordano
6 - Meteoroid

Hello!

I am trying to substitute a formula in excel into a workflow.

There's a "Malformed IF Statement, but i don't know why.

 

This is the Formula in alteryx :

 

 

if IsNull([processedDate]) and [wft_purging_date]=[aura_arch_date] 
 
then "request verificate archiviate correttamente" else 
 
if IsNull([wft_purging_date]) 
then "wft purging date non è compilata" 
else 
 
if [wft_purging_date]=[aura_arch_date] then "wft=aura_arch_date" 
else [wft_purging_date]-[processed+45] 
endif

 

I have to add an "IFERROR" so I think to  substitute the iferror with the IsNull.

 

Someone can find the error?


Thank you so much.

5 REPLIES 5
messi007
15 - Aurora
15 - Aurora

@giadagiordano,

 

Please try bleow

 

if (IsNull([processedDate]) and [wft_purging_date]=[aura_arch_date] )
 
	then "request verificate archiviate correttamente" 
	else 
		if IsNull([wft_purging_date]) 
			then "wft purging date non è compilata" 
			else 
		if [wft_purging_date]=[aura_arch_date] then "wft=aura_arch_date" 
			else [wft_purging_date]-[processed+45] 
		endif
	ENDIF
endif

If it doesn't work please share a sample data 🙂

 

Regards,

BenMoss
ACE Emeritus
ACE Emeritus

Hi!

 

as pointed out by the above poster, for every IF you have you must also then have an ENDIF.

 

However, in Alteryx if you use ELSEIF instead of ELSE IF, then you will then only need a single ENDIF statement.

 

For example...

 

 

IF ISNULL([field]) THEN “A” ELSE IF [Field]=“Bob” THEN “BOB” ELSE “OTHER” ENDIF ENDIF

 

Can be better written as...

 

IF ISNULL([field]) THEN “A” ELSEIF [Field]=“Bob” THEN “BOB” ELSE “OTHER” ENDIF

 

With the only difference being the space between else and if.

 

Hope this is useful.

 

Ben

 

giadagiordano
6 - Meteoroid
if IsNull([processedDate]) and [wft_purging_date]=[aura_arch_date] 
 
then "request verificate archiviate correttamente" else 
 
if IsNull([wft_purging_date]) 
then "wft purging date non è compilata" 
else 
 
if [wft_purging_date]=[aura_arch_date] then "wft=aura_arch_date" 
else [wft_purging_date]-[processed+45] 
endif endif endif
 
Hello, thank you for replying.
Now error is "Invalid type in substraction operator". All the input columns are in "Date" and output should be "date" or "String", it depends on the result of the formula.
Do you know what should I do?
 
Thank you so much!!!
PhilipMannering
16 - Nebula
16 - Nebula

In Python you can subtract dates like you would numbers,

PhilipMannering_0-1606685906359.png

In Alteryx, no such luck. You need to use the DateTime functions. Try,

DateTimeDiff([wft_purging_date], [processed+45], 'days')

 

giadagiordano
6 - Meteoroid

It works 😁

Really THANK YOU SO MUCH!

So fast!

Labels