Technote (FAQ)
Question
Why does running a template with Rational Publishing Engine 1.2 produce different output results than running a template with earlier versions of Rational Publishing Engine?
Cause
In Rational Publishing Engine 1.2, how variables are passed between assignments and conditions has changed.
Answer
In Rational Publishing Engine 1.1.2.2 and earlier, all variables were transformed to strings when they were introduced in a script expression. In Rational Publishing Engine 1.2, variables preserve the type and the exact value of the last assignment; they are no longer transformed to strings. This change helps the building and processing of complex structures in JavaScript, but it also can affect the behavior of existing templates.
This change has a negative impact when dealing with variables that are compared to the string literals "true"/"false" in expressions like variable == "true".
If the value of the variable comes from the document specification, i.e. it was provided by the user when configuring the report or it is the default value of the variable, then everything works as before since the variable is still a string. But if the value comes from a prior computation, say variable = (1 < 2), then the value of the variable results in Boolean true, not the string literal "true". This result means that conditions including the variable == "true" comparison evaluate to false, even though the data is the same.
To address this issue, you need to update the conditions so that they are able to handle both scenarios. You can change conditions like variable=="true" to check for equality with both the string literal "true" as well as with the Boolean true. Example: (variable == true) || ( variable == "true")
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.