Support Article
Equal operator is not working between date&string in PRPC 6
SA-25818
Summary
Equals "==“operator is not working between date and string data types in Pega 7 version, but the same is working in Pega 6 version. In Pega 6 if they try to compare string and date property with "==" operator its returning true value where as in Pega 7 it’s returning False.
Error Messages
Not Applicable.
Steps to Reproduce
1. Write one test activity and set the date value into one date property.
2. In the 2nd step of the activity, set the property value to one parameter, do not define this param in parameter tab as date type.
3. Use "==" Operator to compare this Param and date property.
Root Cause
Behavior is correct in Pega 7.x version. One must not compare String parameter with the DateTime Property.
When it is a String parameter and its value is PegaRules internal Date format (example, 20160101T000000.000 GMT), if user directly converts to BigDecimal, it fails with Invalid Number Format.
In PRPC 6.x, assembly was generating incorrect code for parameter while rendering the expression for when condition.
promptedPegaType() for getting the parameter type was used, but one must be using pegaType(). This is fixed as part of BUG in Pega 7.x version.
Resolution
Change the parameter Type to DateTime.
Published July 28, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.