You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the States.ArrayPartition intrinsic function to partition a large array. You can also use this intrinsic to slice the data and then send the payload in smaller chunks.
This intrinsic function takes two arguments. The first argument is an array, while the second argument defines the chunk size. The interpreter chunks the input array into multiple arrays of the size specified by chunk size. The length of the last array chunk may be less than the length of the previous array chunks if the number of remaining items in the array is smaller than the chunk size.
Input validation
You must specify an array as the input value for the function's first argument.
You must specify a non-zero, positive integer for the second argument representing the chunk size value.
The input array can't exceed Step Functions' payload size limit of 256 KB.
For example, given the following input array:
json {"inputArray": [1,2,3,4,5,6,7,8,9] }
You could use the States.ArrayPartition function to divide the array into chunks of four values:
json"inputArray.$": "States.ArrayPartition($.inputArray,4)"
Which would return the following array chunks:
json{"inputArray": [ [1,2,3,4], [5,6,7,8], [9]] }
In the previous example, the States.ArrayPartition function outputs three arrays. The first two arrays each contain four values, as defined by the chunk size. A third array contains the remaining value and is smaller than the defined chunk size.
The text was updated successfully, but these errors were encountered:
meenahoda
changed the title
Intrinsic function: Array.GetPartition
Intrinsic function: States.ArrayPartition
Oct 17, 2023
States.ArrayPartition
Use the States.ArrayPartition intrinsic function to partition a large array. You can also use this intrinsic to slice the data and then send the payload in smaller chunks.
This intrinsic function takes two arguments. The first argument is an array, while the second argument defines the chunk size. The interpreter chunks the input array into multiple arrays of the size specified by chunk size. The length of the last array chunk may be less than the length of the previous array chunks if the number of remaining items in the array is smaller than the chunk size.
Input validation
You must specify an array as the input value for the function's first argument.
You must specify a non-zero, positive integer for the second argument representing the chunk size value.
The input array can't exceed Step Functions' payload size limit of 256 KB.
For example, given the following input array:
json {"inputArray": [1,2,3,4,5,6,7,8,9] }
You could use the States.ArrayPartition function to divide the array into chunks of four values:
json"inputArray.$": "States.ArrayPartition($.inputArray,4)"
Which would return the following array chunks:
json{"inputArray": [ [1,2,3,4], [5,6,7,8], [9]] }
In the previous example, the States.ArrayPartition function outputs three arrays. The first two arrays each contain four values, as defined by the chunk size. A third array contains the remaining value and is smaller than the defined chunk size.
The text was updated successfully, but these errors were encountered: