I have a JSON with the following schema:
"invoices-report": {
"locations": {
"location": {
"@code": "TX",
"@name": "Texas",
"invoices": {
"invoice": [
{
"@InvoiceNumber": "111111",
"@AccountName": "Name",
"@InvoiceDate": "2021-11-01",
"items": {
"item": [
{
"@QTY": "1.00",
"@Rate": "5",
"@Description": "Services"
},
{
"@QTY": "2.00",
"@Rate": "5",
"@Description": "Services1"
},
…
{
"@QTY": "2.00",
"@Rate": "5",
"@Description": "ServicesN"
},
}
]
}
},
{
"@InvoiceNumber": "222222",
"@AccountName": "Name2",
"@InvoiceDate": "2021-11-01",
"items": { …..}
Basically I have an array of invoice numbers with subarray of Invoice Details. I would like to split it to 50 parallel branches to speed up processing. My flow looks like this:
Parse Json -> Create Variable ->
length(array(body('Parse_JSON')?['invoices-report']?['locations']?['location']?['invoices']?['invoice']))
For example, the variable returns 56,900 invoices. I would like to create 50 branches based on array order No. - >56,900/50=1,138 - > if invoice order numbers 0 - 1,138 - process these invoices in the first branch and so on. Each branch would also contain "Apply to each" function with degree of Parallelism of 50. Could you please explain how do I divide the array on 50 branches? Thank you in advance!