Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
teste11234
Helper I
Helper I

Dataflow refresh limitation of Computed Entity to work on Pro Workspace

Hi guys,

I need your help on the query below.

I put the function inside the query to resolve the dataflow refresh limitation of Computed Entity to work on Pro Workspace.

But I have got this message: "We cannot convert a value of type Table to type List."

teste11234_0-1681420513212.png

 

let

  GetPageClientesFunction = (page as text) as list =>
  let
    Source = try Json.Document(Web.Contents("https://api.akhsfkjaskfjsajf.io/",
                [
                RelativePath = "v2/customers?page=" & page & "&limit=1000",
                Headers=[Authorization="jsfshfhsjfjsafasfjkakjfskj"]])) otherwise [customers=null],
    #"Converted to Table" = Table.FromRecords({Source})
  in
    #"Converted to Table",

  Source = List.Generate(
          () => [PAGE = 1, RESULTS = GetPageClientesFunction("1")],
          each Table.RowCount(Table.SelectRows([RESULTS], each [count]>0)) >0,
          each [PAGE = [PAGE] + 1, RESULTS = GetPageClientesFunction(Number.ToText([PAGE] + 1))],
          each [RESULTS]),
  #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error)

in
  #"Converted to Table"
 
Many tks,
---
Alexandre.
1 ACCEPTED SOLUTION
teste11234
Helper I
Helper I

I got it, I got it... I confess, ChatGPT help me a lot. Here is the final solution.

I introduce List.Buffer and Table.Buffer to turn faster execution of the query.

let
    getPageClientes = (page as text) =>
        let
            Source = try Json.Document(Web.Contents("https://api.sensedata.io/",
            [
            RelativePath = "v2/customers?page=" & page & "&limit=1000",
            Headers=[Authorization="Bearer sadasfasfasfafasfasfasf="]
            ])) otherwise [customers=null],
            #"Converted to Table" = Table.Buffer(Table.FromRecords({Source}),[BufferMode = BufferMode.Delayed])
        in
            #"Converted to Table",
    Source = List.Buffer(List.Generate(
    () => [PAGE = 1, RESULTS = getPageClientes("1")],
    each Table.RowCount(Table.SelectRows([RESULTS], each [count]>0)) >0,
    each [PAGE = [PAGE] + 1, RESULTS = getPageClientes(Number.ToText([PAGE] + 1))],
    each [RESULTS]
    )),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"customers", "per_page", "current_page", "count", "next_page"}, {"customers", "per_page", "current_page", "count", "next_page"})
    in
    #"Expanded Column1"

View solution in original post

1 REPLY 1
teste11234
Helper I
Helper I

I got it, I got it... I confess, ChatGPT help me a lot. Here is the final solution.

I introduce List.Buffer and Table.Buffer to turn faster execution of the query.

let
    getPageClientes = (page as text) =>
        let
            Source = try Json.Document(Web.Contents("https://api.sensedata.io/",
            [
            RelativePath = "v2/customers?page=" & page & "&limit=1000",
            Headers=[Authorization="Bearer sadasfasfasfafasfasfasf="]
            ])) otherwise [customers=null],
            #"Converted to Table" = Table.Buffer(Table.FromRecords({Source}),[BufferMode = BufferMode.Delayed])
        in
            #"Converted to Table",
    Source = List.Buffer(List.Generate(
    () => [PAGE = 1, RESULTS = getPageClientes("1")],
    each Table.RowCount(Table.SelectRows([RESULTS], each [count]>0)) >0,
    each [PAGE = [PAGE] + 1, RESULTS = getPageClientes(Number.ToText([PAGE] + 1))],
    each [RESULTS]
    )),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"customers", "per_page", "current_page", "count", "next_page"}, {"customers", "per_page", "current_page", "count", "next_page"})
    in
    #"Expanded Column1"

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.