March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I am trying to adopt the code located on this page Paginate REST API but I am receiving an error. Can someone assist with troubleshooting this error? I am receiving the error:
Expression.Error: We cannot apply field access to the type List.
Details:
Value=[List]
Key=total_count
let
EntitiesPerPage = 100,
Limit="_limit=" & Text.From(EntitiesPerPage),
Url = "https://jsonplaceholder.typicode.com/comments?" & Limit,
GetJson = (Url) =>
let
RawData = Web.Contents(Url),
Json = Json.Document(RawData)
in Json,
GetEntityCount = () =>
let Url = Url & "&_start=0",
Json = GetJson(Url),
Count = Json[#"total_count"]
in
Count,
GetPage = (Index) =>
let
//(option A)offset equal to previous row count
offset = "&_start=" & Text.From(Index * EntitiesPerPage),
Url = Url & offset,
Json = GetJson(Url),
Value = Json[#"jobs"]
in
Value,
EntityCount = GetEntityCount(),
PageCount = Number.RoundUp(EntityCount / EntitiesPerPage),
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
Solved! Go to Solution.
I was able to figure out this so I will mark this as a solution. I had to break down the code from the link above line by line to figure it out. It was long process. As an example this line
Value = Json[#"jobs"]
In my case API provided the total so I had to call it differently
Value = Json[#"total_count"]
I was able to figure out this so I will mark this as a solution. I had to break down the code from the link above line by line to figure it out. It was long process. As an example this line
Value = Json[#"jobs"]
In my case API provided the total so I had to call it differently
Value = Json[#"total_count"]
I had to go through each line of code and was able to get it working but had to block off #1 and #2. I can understand #1 since its pulling the count of only 10 records so it returns the value of 10 but it needs to pull the count of all records which is 500. In #2 not sure why that piece of code was there. Can anyone comment on #1 and #2 please.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |