Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi there,
The following code always returned duplicated records of the ones on the 1st page. For example, there's 155 pages of data, the data on the 1st page gets duplicated 155 times, while no data from 2nd page onward is there. Can someone please help? Thanks a lot.
***
// Define page size
pageSize = 500,
currentPage = 1,
// funtion to get 1 page of data
GetVulnerabilitiesPage = (page) =>
let
// API call URL
url = apiUrl & "?page=" & Text.From(page) & "&per_page=" & Text.From(pageSize),
// Send API call
source = Json.Document(Web.Contents(url, [Headers=[#"X-Risk-Token"=apiKey]])),
// Pull data
vulnerabilities = source[vulnerabilities]
in
vulnerabilities,
// Get total records
GetEntityCount = () =>
let
//API call URL
url = apiUrl & "?page=1" & "&per_page=" & Text.From(pageSize),
// API call
source = Json.Document(Web.Contents(url, [Headers=[#"X-Risk-Token"=apiKey]])),
// Record number
value = source[meta][total_count]
in
value,
// Total page count (-150 below is for quick debug purpose, to get less results.)
VulnCount = GetEntityCount(),
totalPages = Number.RoundUp(VulnCount / pageSize) - 150,
// Get all records
allVulnerabilities = List.Generate(
() => [Page = 1, Data = GetVulnerabilitiesPage(1)],
each [Page] <= totalPages,
each [
Page = _[Page] + 1,
Data = GetVulnerabilitiesPage([Page])
],
each _[Data]
Solved! Go to Solution.
It's paging, not pagination.
Handling paging for Power Query connectors - Power Query | Microsoft Learn
It's paging, not pagination.
Handling paging for Power Query connectors - Power Query | Microsoft Learn
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |