Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |