Ask a Question

Sum of two variable values

gdave
Regular Contributor

Sum of two variable values

Hi all

 

I am trying to sum up the total of two different variables and store the value in a third variable. However, for some odd reasons, the variable (result) is reflecting the individual value of each variable and not the sum total. I am not sure what wrong have I done. Can some please advise ?

 

gdave_1-1617716403059.png

 

gdave_0-1617716261225.png

gdave_2-1617716614074.png

I would have expected a sum total of above two values to reflect in the result variable.

 

Thanks in advance.

 

11 REPLIES 11
gdave
Regular Contributor

Hi @ebarbera 

 

Much appreciated.

 

The project is in Delphi.

 

Thanks

G

Hi @gdave 

 

function GetSubString;
var Str;
begin
Str := '$40,900.99';

// Uses the SubString method
Log.Message( aqString.Replace(Str, '$', '') ); // Posts "1234"
Log.Message( aqString.Replace(Str, ',', '') ); // Posts "45678"
Log.Message(Str); // Posts "789"

end;

 

 

This should do what you are looking for! Let me know if you have any questions.  You can run this in a keyword test using a "Run Script Routine" operation. Also you will want to use a persistent project level variable to store the variable so you can manipulate it in the function and then use it in your checkpoint.

cancel
Showing results for 
Search instead for 
Did you mean: