Skip to main content
Nintex Community Menu Bar

Calculated Value If date is less than 12/31/2017

  • April 13, 2018
  • 2 replies
  • 22 views

kmccool
Forum|alt.badge.img+9

Hey Everyone,

I'm struggling to get this calculated value working. My formula is: If(date<12/31/2017,field*.535,field*.545)

Basically if the date entered is less than a certain date, I would like it to calculate using the first value, and if it's not I would like it to calculate with the second value.

However, my calculation always ends up the same amount no matter if it meets the condition or not.

I've tried:

If(TransDate<12/31/2017,Miles*.535,Miles*.545)

If(lessThanOrEqual(TransDate,12/31/2017),Miles*.535,Miles*.545)

Thanks for the help!

Kassie

Update:

ok, I thought maybe instead of combining the if and the calculation, I would just make two calculated value fields and add rules to hide or show the calculation. the rule is lessThanOrEqual(Date,12/31/2017).

this isn't working either. Is there something funky I need to know about using date fields for rules?

Thanks again

Kassie

2 replies

Forum|alt.badge.img+14
  • Scholar
  • April 17, 2018

if you have written dates in a form just like you posted above, then note they are not taken as dates by the rule engine, but rather as math expressions that divide 3 figures. so you compare dates with a value like 0.000192 (12/31/2017).

you should use ConvertToDate() function to make date out of a string, like ConvertToDate("12/31/2017").

note however, ConvertToDate() is buggy in recent forms version(s), and your formulas need not work even that way.


kmccool
Forum|alt.badge.img+9
  • Author
  • Scholar
  • April 17, 2018

Again, Thanks for your help Marian. happy.png

The convert to date is working. Here's how I changed my formula: If(greaterThanOrEqual(TransDate,convertToDate("12/31/2017")),Miles*.535,Miles*.545)

Kassie