Hi Everyone!
I'm fairly new to Alteryx and am having trouble with an IF THEN statement.
I have the following and am getting a malformed statement error:
if [AdmitAMPM]="AM" then [AdmitTime]
elseif [AdmitAMPM]="PM" then [AdmitTime]+12
else 0
endif
AdmitAMPM is vstring and AdmitTime is double
My new variable will be AdmitHour and I have it listed as Double
Any help would be much appreciated!
Solved! Go to Solution.
Hello @emarsha1 ,
Which tool are you getting this in. It is not the formula? just tested it and its ok.
Can you please provide a screen shot of where you are issuing this statement.
Would it be possible to share your workflow? Just a few rows with those fields. I don't immediately see an issue with the syntax, but I'm wondering about the [AdmitTime] field. Is something like 1200, 1300, etc?
I'm using the formula tool
Admit time is essentially the hour from the AdmitDate field
Hello @emarsha1 ,
It looks to me that Admittime is not suitable for addition operation.
Please check it and make sure it is so. I can see the red underneath it.
Just a bit of test, take out the 12 and see if doesn't complain anymore.
Hello @emarsha1 ,
I see what's happening, It may well be the null values.
Can you replace nulls with 0 using the datacleansing tool on that field or all of them.
That worked! Just needed to change AdmitTime to double.
Thank you!!!
User | Count |
---|---|
52 | |
27 | |
25 | |
24 | |
21 |