Forum Discussion
Need help for Paging power query based on offset and limit
Hi,
I have written the below code:
in getData function as below:
= (Offset as number) as table =>
let
Source = Json.Document(Web.Contents("https://amerisourcebergentest.service-now.com/api/now/table/u_tap_request?sysparm_display_value=false&sysparm_exclude_reference_link=true&sysparm_offset=" & Number.ToText(Offset) & "&sysparm_limit=99")),
#"Converted to Table" = Record.ToTable(Source),
#"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"),
#"Expanded Value1" = Table.ExpandRecordColumn(#"Expanded Value", "Value", {"parent", "u_solution_complexity_date_time", "u_supplier_name", "watch_list", "upon_reject", "requested_for", "sys_updated_on", "approval_history" }, {"Value.parent", "Value.u_solution_complexity_date_time", "Value.u_supplier_name", "Value.watch_list", "Value.upon_reject", "Value.requested_for", "Value.sys_updated_on", "Value.approval_history", "Value.skills", "Value.number", "Value.u_solution_compllexity_not_required", "Value.state", "Value.u_approved_funding_confirmed_by_finance", "Value.sys_created_by"}),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Value1",{"Name"})
in
#"Removed Columns"
But when I execute the below code it gives me error and it seems to me that it is doing extra looping :
error message:
let
Source = List.Generate(()=>
[Result = try getData(1) otherwise null, Page=1],
each [Result] <> null,
each [Result = try getData([Page]+99) otherwise null, Page=[Page]+99],
each [result]
)
in
Source
Hi Sandip, i have the same task, i hope you hvae fighred out, please can you send the whole code? thank you