Reputation: 73
I have a StepFunction with input:
{
"Jobs": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0]
}
and I want the sum of the values in this array. According to the Json-Path docs there should exist a .sum()
function for this. When I try it here it even works. So I defined the following Pass state:
"Sum Jobs": {
"Type": "Pass",
"Parameters": {
"Jobs.$": "$.Jobs.sum()"
}
},
Nevertheless executions fail with:
"An error occurred while executing the state 'Sum Jobs' (entered at the event id #249). The JSONPath '$.Jobs.sum()' specified for the field 'Jobs.$' could not be found in the input '{\"Jobs\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0]}'"
Upvotes: 0
Views: 836
Reputation: 25739
You will need a Lambda Task for this. Step Functions' intrinsic functions (= operations accessible outside of tasks), do not include any math or array manipulation operations.
Upvotes: 1