I have the following state defined in my state machine.
"loop":{
"Type": "Pass",
"Result":{
"totalCount": "$.newFieldsResponse.body.count",
"currentCount": 0,
"step": 1
},
"ResultPath": "$.iteration",
"Next":"iterateLoop"
},
I expect the output of the state to be:
"newFieldsResponse": {
"isSuccess": true,
"error": "",
"body": {
"count": 2,
"fields": [...]
}
},
"iteration": {
"totalCount": 5,
"currentCount": 0,
"step": 1
}
}
iteration property is added to the input with totalCount property to be set to count of items in fields array.
However, the output for "iteration" property is set as:
"iteration": {
"totalCount": "$.newFieldsResponse.body.count",
"currentCount": 0,
"step": 1
}
It looks like the value "$.newFieldsResponse.body.count" is not getting resolved and is output as is.
Is there something I am doing wrong ? Can someone please advice on how to make it work ?
This is possible through "Parameters" in pass state
JSON
{
"loop": {
"Type": "Pass",
"Parameters": {
"totalCount": "$.newFieldsResponse.body.count",
"currentCount": 0,
"step": 1
},
"ResultPath": "$.iteration",
"Next": "iterateLoop"
}
}