Forum Discussion

conehead's avatar
conehead
Occasional Contributor
8 years ago
Solved

Math Calculation with On Screen values.

I need to do a simple calculation using four screen values and pass the results to an If Then statement for a Log Message.

 

I added four string variables to my test. For each I set the Mode: 'Object Property', set variable value Object Type to 'Onscreen object' and pointed with the target glyph. Then I selected the property of the object 'Text'.

 

Afterwards, I added an If Then statement comparing two code expressions (VAR1 + VAR2) != (VAR3 + VAR4). The if statement doesn't work properly because the '+' only concatenates the two strings, does not do a math calculation.
When I change the code expressions to (number(VAR1) + number(VAR2)) != (number(VAR3) + NUMBER(vAR4)), the Run Test can't handle it and issues an Exception with Additional Info: Reference Error number is not defined.

 

Can someone please tell me if I'm missing something obvious or if there's a way to do the simple calculation with the screen values.

Thanks,
Steve