<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API loop with List.IsEmpty not working in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3234954#M42656</link>
    <description>&lt;P&gt;Hi, thanks for your reply! Unfortunately, I tried that and it did not change the error. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; It ist literally exactly the same error message as before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TrainPerson_0-1684134160387.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/914653i2265FDA8A7F86215/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TrainPerson_0-1684134160387.png" alt="TrainPerson_0-1684134160387.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 May 2023 07:02:45 GMT</pubDate>
    <dc:creator>TrainPerson</dc:creator>
    <dc:date>2023-05-15T07:02:45Z</dc:date>
    <item>
      <title>API loop with List.IsEmpty not working</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3230891#M42630</link>
      <description>&lt;P&gt;I am trying to call a REST API with a POST request. There is a limit of 1000 entries per page and it is unclear how many pages there are. I found a sample solution that seems to fit, which is to call every page until they come back empty. However the script is not quite working for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works when I hardcode the page limit (iterating from page 0 to 10) like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;= List.Generate(&lt;BR /&gt;() =&amp;gt; [offset = 0, List = #"API Query (test)" (0) ],&lt;BR /&gt;each [offset] = 10,&lt;BR /&gt;each [offset = [offset] + 1, List = #"API Query (test)" ( [offset] ) ],&lt;BR /&gt;each [List]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however when I try to give a dynamic limit like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;= List.Generate(&lt;BR /&gt;() =&amp;gt; [offset = 0, List = #"API Query (test)" (0) ],&lt;BR /&gt;each not List.IsEmpty( [List] [results] ),&lt;BR /&gt;each [offset = [offset] + 1, List = #"API Query (test)" ( [offset] ) ],&lt;BR /&gt;each [List]&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TrainPerson_0-1683811236435.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/913479iBA4742190540533C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TrainPerson_0-1683811236435.png" alt="TrainPerson_0-1683811236435.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The API topic is completely new to me, so even after some research I'm coming up empty on ideas what could be the issue.&lt;/P&gt;&lt;P&gt;Thanks a lot in advance to anyone with ideas.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 13:24:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3230891#M42630</guid>
      <dc:creator>TrainPerson</dc:creator>
      <dc:date>2023-05-11T13:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: API loop with List.IsEmpty not working</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3233992#M42654</link>
      <description>&lt;P&gt;"List" is a reserved word.&amp;nbsp; Find another name for your variable.&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 00:18:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3233992#M42654</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-14T00:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: API loop with List.IsEmpty not working</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3234954#M42656</link>
      <description>&lt;P&gt;Hi, thanks for your reply! Unfortunately, I tried that and it did not change the error. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; It ist literally exactly the same error message as before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TrainPerson_0-1684134160387.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/914653i2265FDA8A7F86215/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TrainPerson_0-1684134160387.png" alt="TrainPerson_0-1684134160387.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 07:02:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3234954#M42656</guid>
      <dc:creator>TrainPerson</dc:creator>
      <dc:date>2023-05-15T07:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: API loop with List.IsEmpty not working</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3235576#M42662</link>
      <description>&lt;P&gt;Lists are not records.&amp;nbsp; They only have indexes, so you can address their rows. In other words, list have only one column.&amp;nbsp; So&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;each not List.IsEmpty( [List] [results] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;won't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead you can use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;each not List.IsEmpty( [List])&lt;/LI-CODE&gt;
&lt;P&gt;or equivalent.&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 11:55:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3235576#M42662</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-15T11:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: API loop with List.IsEmpty not working</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3235818#M42665</link>
      <description>&lt;P&gt;Hmm... ok. So this worked, but not as intended.&amp;nbsp;It also shows and error message, but weirdly behind the error message are just&amp;nbsp;records. It gives me back the first 1000 records (max records available per page) of the first page, but nothing beyond that, as if the looping isn't continuing?&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 13:45:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3235818#M42665</guid>
      <dc:creator>TrainPerson</dc:creator>
      <dc:date>2023-05-15T13:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: API loop with List.IsEmpty not working</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3235861#M42666</link>
      <description>&lt;P&gt;Seems to work fine here&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWMgKTxmDSBEyaKsXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    APIQuery = (n)=&amp;gt; if n&amp;lt;6 then {0..n} else {},
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", (k)=&amp;gt; List.Generate(
() =&amp;gt; [offset = 0, List = APIQuery(0) ],
each not List.IsEmpty( [List]),
each [offset = [offset] + 1, List = APIQuery( [offset] ) ],
each [List]
)),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Expanded Custom1" = Table.ExpandListColumn(#"Expanded Custom", "Custom")
in
    #"Expanded Custom1"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 15 May 2023 14:06:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3235861#M42666</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-15T14:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: API loop with List.IsEmpty not working</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3235919#M42667</link>
      <description>&lt;P&gt;Oh, I think I understand now. It keeps looping until it calls an empty page, which then shows up as an error. So that actually works perfectly, I was just very confused why the list error didn't disappear.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TrainPerson_0-1684161468373.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/914893i2F47DBCBDE2CC101/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TrainPerson_0-1684161468373.png" alt="TrainPerson_0-1684161468373.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So basically I can go from there and remove the empty page/just expand all the records and have the full data! Thanks a lot for your help!!&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 14:41:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3235919#M42667</guid>
      <dc:creator>TrainPerson</dc:creator>
      <dc:date>2023-05-15T14:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: API loop with List.IsEmpty not working</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3283132#M43072</link>
      <description>&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/559093"&gt;@TrainPerson&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;If these also don't help, please share more detailed information and description to help us clarify your scenario to test.&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;&lt;A href="http://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;How to Get Your Question Answered Quickly&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Regards,&lt;/P&gt;
&lt;P style="margin: 0in; font-family: tahoma; font-size: 11.0pt;"&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 07:45:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-loop-with-List-IsEmpty-not-working/m-p/3283132#M43072</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-14T07:45:53Z</dc:date>
    </item>
  </channel>
</rss>

