Forum Discussion

autoscout24's avatar
autoscout24
Contributor
15 years ago

[Resolved] Increment Row in DataSource Groovy Step

Hi Support team,
I have situation where i have to use DataSource and update the property via groovy script. I have only 1 property and I need to update 15 rows for that property.
when the run script, i cannot able to increment and update the row for that property via groovy script.

Instead i always get a dialog 2 enter the no. of row. after I enter the required number, i get 15 row with all same value (last value)

Please refer screen shot for more details.

Regards
Vijay
  • Hi!

    the groovy datasource works a bit differently; the script is passed a "result" map variable that it should fill with the data for the current row; if it is left empty this is interpreted as there is no more data. So in your example you could try:

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def sProjectPath = groovyUtils.projectPath

    // get current row
    def row = context.currentStep.currentRow
    if( row < 15 )
    result["FilePath"] = sProjectPath + "\\File" + (row+1) + ".jpg"


    Does that help?

    regards!

    /Ole
    eviware.com
  • Hi, Ole.

    I've just bumped into the similar problem. Your solution works perfectly. Thanks.

    Regards, Sergey.