Hi all,
I am struggling to find what is the problem in that simple IF statement and I would appreciate to have your help:
IF [Warranty expiration]>2 AND [Warranty expiration]<7 THEN "Wave 1"
ELSEIF [Warranty expiration]>6 AND [Warranty expiration]<10
THEN "Wave 2"
ELSE "Wave 3"
ENDIF
The statement it seems fine until I am entering the last value "Wave 3" and specifically the last ".
The Warranty expiration is an Int32 field that has been created by the DateTimeMonth([Warranty expiration]) expression and saves the number of the month.
There are no Nulls is that.
The "Wave x" is save to a new column as string.
Thanks in advance,
Kostas
Solved! Go to Solution.
Hi @Kostas ,
The formula is working as it should when [Warranty expiration] is an int number, if it is a string, it does exactly what you are relating. Maybe you forgot to update the data type in your formula DateTimeMonth([Warranty expiration])
Best,
Fernando Vizcaino
Hi @Kostas
I'd first check the data type of the field [Warranty expiration]. Although the formula does result in an Int, the formula tool will save it as text unless you specify the data type should be Int. I make that error all of the time, forgetting to set data types.
Is the problem that the formula itself is failing everywhere, or only when the data in Warranty Expiration doesn't fall into the criteria for Wave 1 or Wave 2? Seeing the actual errors can help us troubleshoot what's going on
Cheers!
Esther
Thank you both for the fast reply.
It seems that it is a data type issue since the formula is working for you Fernado. I am getting the error that you are getting when it is changing to string:
Is there somewhere else that I need to set the data type for Warranty expiration field?
/Kostas
Hi @Kostas
Try changing the variable in your formula to [Month of expiration], which is the Int field from the formula that determines the month.
Cheers!
Esther
Of course, that was the issue....
Many thanks Esther!