cancel
Showing results for 
Search instead for 
Did you mean: 

Compare text property of two objects

SOLVED
Occasional Contributor

Compare text property of two objects

Hello,

I am having a simple issue trying to compare two text values in keyword test where one value is greater than other.

I had used compare property checkpoint, and the comparision is not correct.(you can see it from the printscreen).

After that i had tried to do it in script, same with compare property checkpoint and the result was the same as in the keyword test.

Also i had tried to do with if then statement: if (raspSr > vkIznos) then Log.message('ok') else log.error('notok') where i had defined my two variables as a String( var raspSr: string; var vkIznos: string), but it doesnt help. I constantlly get the incorrect results  for everything mention above.

I am sending you the printscreen results, any help will be welcomed. 1.png

 

2.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: Compare text property of two objects

Hi @trajmo , 

 

Try converting the strings to integer with aqConvert.StrToInt fetching the value with aqObject.GetPropertyValue and then comparing them with aqObject.CompareProperty. 

If you need you can use 

SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, ',');
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, '.');

to get the specific format that is displayed in your print screen pictures.

Hope this helps

 

View solution in original post

4 REPLIES 4
Occasional Contributor

Re: Compare text property of two objects

I had tried to convert the value which doesnt have the wtext property with FloatToStr and now it doesnt give the value with spaces between, but still the message from the log is incorrect.

 

3.png

 

Community Hero

Re: Compare text property of two objects

To do numeric comparisons like that you will need to convert your string into number format.


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Occasional Contributor

Re: Compare text property of two objects

Hi @trajmo , 

 

Try converting the strings to integer with aqConvert.StrToInt fetching the value with aqObject.GetPropertyValue and then comparing them with aqObject.CompareProperty. 

If you need you can use 

SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, ',');
SetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, '.');

to get the specific format that is displayed in your print screen pictures.

Hope this helps

 

View solution in original post

Occasional Contributor

Re: Compare text property of two objects

Thanks for the proposed solutions. Special thanks to @mioani for detailed answer, now i get it. The solution you've provided really helped me.

New Here?
Join us and watch the welcome video:
Final Interview in the Series
API_testing_mistake#7
Top Kudoed Authors