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

Be 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

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
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.