PM58631: RPE: Wrong Variables' Calculation in RPE
Closed as user error.
Customer reports that the plus Operator '+' doesn't work properly in RPE 1.1.2. If the user tries to add two internal variables, the value is calculated wrong. I have attached the template and spec he sent. However the steps to reproduce are: 1) create two internal variables with default values. Lets say 100 and 200 respectively. 2) create a template to add the two variables, var1+var2 and generate the report. 3) We would observe that instead of printing 300, it prints 100200. Observations: If I initialize the variables in the script expression, for example, var1=100 var2=200 sum=var1+var2 Now we get 300. However, as mentioned, by using the default values, the addition is not working.
Reviewed and find out this works as designed. In RPE, all variables doesn't have a type, so we don't know about the input type (ie. string, int, double, etc). This is by design. So when you do the double value variable addition, you have to multiply the variables by 1.0 to make it a double. For example, variable A default value 100, variable B default value 200. If you want to add them, you have to use this: A*1.0+B*1.0. If you only use '+', it is considered as string addition. Why this doesn't happen to '-' or other operators? Because other operations could not be used on string, but only '+'.
Reported component name
TLOGIC PUBL ENG
Reported component ID
Last modified date
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following: