Hello,
I am trying to write a multiple level IF statement and am getting a malformed statement. I am not sure where the problem is as I believe that the syntax is correct. Let me know what you all think!
Hey @dougop there's a couple of things I'd check here:
1) Is your [Date Difference Hire] definitely a numeric data type? If it's a string it'll error like you're seeing. You can either change this in a Select tool (before the Formula), or, f you're making this field in a Formula tool then you can just change it in the 'Data Type' dropdown underneath the expression box.
2) On line one, where you have 'THEN [Review]' - are you meaning to reference a field here or should this be "Review"?
Hi @dougop
My best guess is that, given where the formula is saying there's an error, you've got the wrong data type for [date diff term]. Check that it's not a string and then that might work.
What kind of datatype is [date diff term] ? I believe it should be numerical and it isn't :-).
Greetings,
Seb
That's normal behaviour @dougop - the expression won't error until you end it. See here, I have a string value going in that works fine:
Until I end the statement:
If you hit the blue Metadata tab in the bottom left, is it definitely not a string going into the Formula tool? As this erroring is consistent with this.
Edit: Even though it *appears* numeric, coming out of a DateTime tool, the result is actually a string (radio button select is Date/Time format to string) so you'll need to make it numeric:
@dougop ,
Mmmm, can you make a screenshot of the metdata going into the formula tool?
Would be nice to see what types they are :-).
Greetings,
Seb
My understanding is that running it through a datetimeparse will still leave it as a string. Check my screenshot in the formula that's doing the same as yours when stored as a string:
You can wrap the diff term in ToNumber() too if you'd prefer