What's the right way to fetch data in batches and combine all ?

HI I am fetching data from appian report.

I have applied filter also so it won't fetch all the data everytime. but for the very first time it has to fetch everything  from the reocrd and then store in database.

Now just to be on safer side I want to fetch the data in batches and then want to consume it.
I am doing it with the following way

a!localVariables(

local!latestDate: cast(
typeof(now()),
index( rule!MO_GetLatestAuditDetails().data , "endTime" , now()-60)
),

local!processModelUuids: rule!MO_GetAllProcessModels().processModelUuid,


local!totalCount: index(
rule!NEW_MO_ExtractProcessMetricsFromPortalReport(
batchSize: 1,
startIndex: 1,
date: local!latestDate,
processModelUuids: local!processModelUuids
),
"totalCount",
0
),

local!numberOfIterations: = fn!ceiling(local!totalCount / ri!batchSize),
local!listOfIntegers: = enumerate(local!numberOfIterations),

a!forEach(
items: local!listOfIntegers,
expression: rule!NEW_MO_ExtractProcessMetricsFromPortalReport(
processModelUuids: local!processModelUuids,
batchSize: ri!batchSize,
startIndex: 1+ri!batchSize*fv!item,
date: local!latestDate
)
)


)

Now the problem here is I want the one list of all the fetched enteries, but it's returning neseted list of {{},{},{}} (as per my batchSize and count.) , how can I make it a single list like {a1,a2,a3} ?
and is it the right way to fetch the data and to consume it ?

Thanks

  Discussion posts and replies are publicly visible