Forum Discussion
Tony2021
Aug 20, 2022Iron Contributor
Using IIF and Date()
Experts, I am using IIF to evaluate whether or not a date [InvDueDate] is between the criteria below. It is not evaluating correctly in all cases since it returns "Payment is Pending" even when ...
- Aug 21, 2022That tells you the result is the wrong datatype. The control is expecting one datatype, but the expression is returning a different datatype.
And, with that, I see my mistake. You want to put either a valid date or a text string ("Payment is Pending") in that control. You can't put text into a date field. You'll have to present an alternative way to signal to the user that the payment is pending, a control that does accept text.
Tony2021
Aug 20, 2022Iron Contributor
ok making progress. The "Payment Pending" is no longer showing. I now have a #type! displaying for some of those records.
I tried using the Date()+ 20 and also #2099/1/1# but have #type! for either way.
Do you have a suggestion on how I could return a blank when I get the #type! error? If I could do that then I think my problem is solved.
thank you
I tried using the Date()+ 20 and also #2099/1/1# but have #type! for either way.
Do you have a suggestion on how I could return a blank when I get the #type! error? If I could do that then I think my problem is solved.
thank you
George_Hepworth
Aug 21, 2022Silver Contributor
That tells you the result is the wrong datatype. The control is expecting one datatype, but the expression is returning a different datatype.
And, with that, I see my mistake. You want to put either a valid date or a text string ("Payment is Pending") in that control. You can't put text into a date field. You'll have to present an alternative way to signal to the user that the payment is pending, a control that does accept text.
And, with that, I see my mistake. You want to put either a valid date or a text string ("Payment is Pending") in that control. You can't put text into a date field. You'll have to present an alternative way to signal to the user that the payment is pending, a control that does accept text.
- Tony2021Aug 21, 2022Iron ContributorHi George, thank you for the assistance on this one. I ended up placing some conditional formatting on that field by looking at another date in the record set and shading it white (essentially turning the visible OFF). Might not be the best way to do it but Its seems to display what I want. thank you again for the help.
- George_HepworthAug 21, 2022Silver ContributorSometimes the simpler solution is the right one. There may be some additional code one can write, but usually, it's overkill, IMO.
Congrats on solving the problem.