I'm using this Flow to extract data from a Sharepoint list with more than 5000 rows. I get the lowest and highest ID. Then I initialise the threads variable, so I can query Sharepoint the right number of times. At the moment I'm hardcoding 4 elements into the array and the Flow runs the Apply to each 4 times.
This means the Flow will retrieve data from a list containing up to 20000 rows.
Instead of hardcoding 4 elements into the array and concurrency control, is it possible to work out the highest ID - lowest ID and divide the difference by 5000.
For example if my Sharepoint list has 27000 rows, I would want 6 elements in the array.
I was given the formula below. It works if there are many records.
How can I get it to also work if there is only one record ie first(outputs('Send_an_HTTP_request_to_SharePoint_Get_Highest_ID')['body']['value'])['ID'] = first(outputs('Send_an_HTTP_request_to_SharePoint_Get_Lowest_ID')['body']['value'])['ID']? It's returning an empty array.
range(
1,
if(
greater(
indexOf(
string(
div(
sub(
float(
first(outputs('Send_an_HTTP_request_to_SharePoint_Get_Highest_ID')['body']['value'])['ID']
),
float(
first(outputs('Send_an_HTTP_request_to_SharePoint_Get_Lowest_ID')['body']['value'])['ID']
)
),
5000
)
),
'.'
),
0
),
add(
int(
formatnumber(
div(
sub(
float(
first(outputs('Send_an_HTTP_request_to_SharePoint_Get_Highest_ID')['body']['value'])['ID']
),
float(
first(outputs('Send_an_HTTP_request_to_SharePoint_Get_Lowest_ID')['body']['value'])['ID']
)
),
5000
),
'#0'
)
)
,1
),
int(
formatnumber(
div(
sub(
float(
first(outputs('Send_an_HTTP_request_to_SharePoint_Get_Highest_ID')['body']['value'])['ID']
),
float(
first(outputs('Send_an_HTTP_request_to_SharePoint_Get_Lowest_ID')['body']['value'])['ID']
)
),
5000
),
'#0'
)
)
)
)