Forum Discussion

yarab's avatar
yarab
Occasional Contributor
15 years ago

Re: I think this is a bug

Hi all,

I have this reguest:


 

 
     
        2
        27
     

 


I define two properties: crsDS for cnum and AgeDS for age.

I use this script to do arithmatic operation between the two properties:

def num = context.expand( '${DataSource#crsDS}' )
def age = context.expand( '${DataSource#AgeDS}' )
def subt=age-num
com.eviware.soapui.support.UISupport.showInfoMessage( age + " - " + num + " = " + subt )

The value of properties are read from a Grid datasource.

1- Is this a bug?:

Result of operation  :o:
15 - 1 = 5 ?
3-4=3?
37-3=7?
24-2=4?
...etc

2- Why it reads one line and skip one line from the Grid datasourse( it reads line 1,3,5,7 ..etc) ?

Thank you

2 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    the subtraction-issue is because these are interpreted as strings, not numbers, you need to convert them first with Integer.parseInt( ... ) first

    The problem with every second line is puzzling.. which version are you using?

    regards!

    /Ole
    eviware.com
  • yarab's avatar
    yarab
    Occasional Contributor
    Thank you sooo much, it works 

    about the second issue: I'm using soapUI Pro 3

    Regards