Forum Discussion
4 Replies
Sort By
- M_McDonaldSuper ContributorI have used a Datasource / Datasource Loop with a Groovy step between which appended the Datasource elements to a property, then used the property after exiting the loop.
def gu = new com.eviware.soapui.support.GroovyUtils( context )
def countryCode = context.expand( '${DataSource#CountryCode}' )
def countryName = context.expand( '${DataSource#CountryName}' )
def frag = context.expand('${Properties#XmlFragment}')
gu.setPropertyValue('Properties', 'XmlFragment', "${frag}<country><code>${countryCode}</code><name>${countryName}</name></country>" )
Resulting XML in Properties#XmlFragment:US
United States FI
Finland
There are other ways to do this in script but this is pretty simple. - omensioContributorThanx!
This solution is working fine!
BR,
Olli - SmartBear_SuppoSmartBear Alumni (Retired)Nice solution!
we should put this in our knowledgebase somehow.. hm.. :-)
regards!
/Ole
eviware.com - M_McDonaldSuper ContributorMaybe there should be an "Aggregator" - a template that can contain the elements from a row of a DataSource which then automagically loops through it to produce the repeating elements.
Related Content
Recent Discussions
- 9 minutes agodipsthorat
- 4 hours agoisbiat
- 2 days agoarmygrad