Forum Discussion

davidp_1's avatar
davidp_1
Occasional Contributor
9 years ago

How to use a variable within the context.expand string (groovy)

I'd like to pass in a variable to the following command within a groovy script, in order to take advantage of the 1.7 functionality with respect to iterations on data sources:

 

context.expand('${Roster#startDate::0}')

 

where "0" would be replaced by an integer value (String or int, doesn't matter as long as it works). 

 

This is probably a basic groovy question but I can't seem the get the right combination.

 

Thanks!

  • Assuming that you have some value in the variable myValue, this would insert the value into the property expansion in lieu of 0:

     

    context.expand('${Roster#startDate::' + myValue + '}')

     

    Kind regards,

    Manne, Ready! API Developer