You can already do this if you initialise the string variable before your loop, see https://app.workato.com/recipes/2436692?st=7cce2c for example
That is a good solution, Thank you.
But it may not work for a nested data structures?
{ "response": { "sOverviews": { "count": 18, "ErList": [ { "Id": '111-SDF-XCD', "Overview": { "UpdateTime": "2022-05-03", "ThisTimeData": { "energy": 58 }, "YearData": { "energy": 255 }, "MonthData": { "energy": 48 }, "DayData": { "energy": 0 }, "currentPower": { "power": 0 }, "measuredBy": "Decoy" } },{ "Id": '111-SDF-XCD', "Overview": { "UpdateTime": "2022-05-03", "ThisTimeData": { "energy": 58 }, "YearData": { "energy": 255 }, "MonthData": { "energy": 48 }, "DayData": { "energy": 0 }, "currentPower": { "power": 0 }, "measuredBy": "Decoy" } },{ "Id": '111-SDF-XCD', "Overview": { "UpdateTime": "2022-05-03", "ThisTimeData": { "energy": 58 }, "YearData": { "energy": 255 }, "MonthData": { "energy": 48 }, "DayData": { "energy": 0 }, "currentPower": { "power": 0 }, "measuredBy": "Decoy" } } .... so on ] } } }
This is a JSON response of a HTTP connector, "ErList" is a nested array of objects. Each object has index "Overview" which is an object containing various objects.
I am trying to loop over "ErList" & create a string like:
ErList[1][Id] + ErList[1][Overview][ThisTimeData][energy] + ErList[1][Overview][currentPower][power]+'\n' ErList[2][Id] + ErList[1][Overview][ThisTimeData][energy] + ErList[2][Overview][currentPower][power]+'\n' ErList[3][Id] + ErList[1][Overview][ThisTimeData][energy] + ErList[3][Overview][currentPower][power]+'\n' ... so on for all the contents of the array
attached is the file containing the entire result of HTTP connector.
See the recipe again for updates demoing how to use a for loop selecting the ErList as your input list to loop over (in your case I believe steps 2/3 would be replaced by the htttp connector (so long as you've specified the output schema.
Send us a ticket, we will try our best to assist you with your problem
Himanshu Sharma
Appending in a String variable
Hello,
I feel Workato variable's usability will extend greatly if there is an ability to
do the following:
;
This use case is quite common & is supported in various platforms/prog languages.
Suggestions/Discussions please?
Thank you.