Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hey, guys!
Can anyone help me with a doubt?
I'm using an API to get some data. I created a function, but when invoking this function, at first it brought me the 3 existing lists, now it is returning only 2 lists. Can anyone tell me what could be happening and how I could solve it?
My function fx_Produtos
(page) =>
let
Source =
Json.Document(
Web.Contents(
"https://api.com.br/",
[
RelativePath = "RelativePath ",
Query =
[
token = "token",
formato = "json",
pagina = Number.ToText(page)
]
]
)
),
Table = Source{0}[table]
in
Source
invoke function
let
totalpages = fx_Produtos(1)[retorno][numero_paginas],
listOfPages = List.Generate(
() => [page = 1, data = fx_Produtos(1)],
each [page] <= totalpages,
each [page = [page] + 1, data = fx_Produtos([page]+1)]
),
#"Converted to Table" = Table.FromList(listOfPages, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"data"}, {"data"}),
#"Expanded data" = Table.ExpandRecordColumn(#"Expanded Column1", "data", {"retorno"}, {"retorno"}),
#"Expanded retorno" = Table.ExpandRecordColumn(#"Expanded data", "retorno", {"produtos"}, {"produtos"}),
#"Expanded produtos" = Table.ExpandListColumn(#"Expanded retorno", "produtos"),
#"Expanded produtos1" = Table.ExpandRecordColumn(#"Expanded produtos", "produtos", {"produto"}, {"produto"})
in
#"Expanded produtos1"
Thanks
Solved! Go to Solution.
Hi @kafreitass,
It seems like you are trying to get data from a paginated API, perhaps you can take a look at the official document helper functions GenerateByPage parts if helps:
Helper functions for M extensions for Power Query connectors - Power Query | Microsoft Learn
Regards,
Xiaoxin Sheng
Hi @kafreitass,
It seems like you are trying to get data from a paginated API, perhaps you can take a look at the official document helper functions GenerateByPage parts if helps:
Helper functions for M extensions for Power Query connectors - Power Query | Microsoft Learn
Regards,
Xiaoxin Sheng
User | Count |
---|---|
98 | |
87 | |
77 | |
67 | |
63 |
User | Count |
---|---|
110 | |
95 | |
95 | |
64 | |
58 |