Forum Discussion

sergeyn213's avatar
sergeyn213
New Member
2 years ago

Transfering Integer array to datasource step property

Hi, 

 

i have an integer array, i receive it from a rest resource 

 

intArray = [1, 2, 3, 4, 5]

 

i want to pass each number to a single property in a datasource step based on how many data rows are requested

for example if i want 3 data rows i get 

 

1 in the first run

2 in the second 

3 in the third 

 

i want this so that i can loop that data source for as many integers as needed.

my current code is :

 

import groovy.json.JsonSlurper

 

def productPropertiesResponse = context.expand('${Product Properties#Response#$[\'data\'][\'fxCurrencyType\']}')

 

def jsonSlurper = new JsonSlurper()


def json = jsonSlurper.parseText(productPropertiesResponse)

 

def currencyCodes = []
json.each { currency ->
currencyCodes.add(currency.currencyCode)
}


i tried using the result["currency"] = currencyCodes

but that just gives me the whole array each row.

 

No RepliesBe the first to reply