/
How to retrieve beyond 1000 items using OData
How to retrieve beyond 1000 items using OData
In some instances, specialized power query is required to retrieve beyond the first 1000 items from the Stratawise OData endpoint.
Instructions
Copy the script below, updating the Tenant ID and Module Name. (Lines 5 & 13)
let
EntitiesPerPage = 1000,
GetEntityCount = () =>
let Json = Json.Document(Web.Contents("https://core.stratawise.com/odata/350/MA@POU", [Query=[#"$count"="true"]])),
Count = Json[#"value"]
in Count,
GetPage = (Index) =>
let Skip = Text.From(Index * EntitiesPerPage),
Top = Text.From(EntitiesPerPage),
Json = Json.Document(Web.Contents("https://core.stratawise.com/odata/350/MA@POU", [Query=[#"$skip"=Skip, #"$top"=Top]])),
Value = Json[#"value"]
in Value,
EntityCount = List.Max({ EntitiesPerPage, GetEntityCount() }),
PageCount = Number.RoundUp(EntityCount / EntitiesPerPage), //1,
PageIndices = { 0 .. PageCount - 1 },
Pages = List.Transform(PageIndices, each GetPage(_)),
Entities = List.Union(Pages),
Table = Table.FromList(Entities, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
Table
Connect to through the existing Odata connection provided through the export prompt in the module grid.
Select Transform Data.
Select Advanced Editor.
Paste the updated script from above and select Done.
Select the icon at the top of the data set to expand.
Then OK.
Select Advanced Editor again.
Copy the resulting script to a text editor and replace “column1.“ with ““ (nothing).
Paste the updated script in and validate the resulting columns appear correct.
Related articles
Related content
How to: Validate items in the Event Queue
How to: Validate items in the Event Queue
More like this
No requests visible in grid.
No requests visible in grid.
More like this
End-User Help
End-User Help
More like this
How do I add automation to complete the parent request based on state of subtasks?
How do I add automation to complete the parent request based on state of subtasks?
More like this
End-User Overview
End-User Overview
More like this
How to install the Stratawise Mobile app
How to install the Stratawise Mobile app
More like this