Unable to Fix IF Statement - Invalid Type in Operator
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I've been using the following statement:
IF [Days Outstanding]<31 THEN "0-30" ELSEIF [Days Outstanding]<61 THEN "31-60" ELSEIF [Days Outstanding]<91 THEN "61-90" ELSE "Over 90" ENDIF
Which keeps giving me an error at the "[Days Outstanding]<91" section saying that there is an invalid type in operator with the "<" underlined.
I cannot figure out what the error.
Appreciate the assistance.
Cheers
Solved! Go to Solution.
- Labels:
- Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@jjg21
Please make sure the column [Days Outstanding] is of data type first.
and I have also ajusted the formula to set the low and high bounding.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@Qiu- if the datatype was wrong - shouldn't it throw off an error at the first compare? That the error apparently occurs at >91 makes me think that formula isn't exactly as transcribed above. Or perhaps the error is that it's a string set to 4 and "over 91" is too many characters so it's truncating.
I'm running it as a cut and paste directly in formula with a number going in and a string coming out and everything is fine. I wouldn't write the formula that way - but it does work. So @jjg21 - try cutting and pasting it from what you posted here and see if fixes. Could be some stray character you're not seeing. @Qiu 's way of course works just as well. And personally, I'd do a switch command with some kind of floor division by 30. But that's just personal preference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@QIU
Thank you! This makes everything work now. Yes - it looks as though the [Days Outstanding] was a Vstring (created through Formula) as opposed to IntXX which now works fine.
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
I am able to run the said formula (copy and paste as-is) without an issue on my local machine. Are you still encountering this issue?
Dawn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Dawn,
Error was fixed on my end upon changing item from Vstring to INT.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@jjg21
if it helps, appreciate you would also mark the solutio as accept.😁
