<?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: List.Generate not working in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2028324#M59699</link>
    <description>&lt;P&gt;Oh yes, that was stupid from me. Delete the "header."-part from the strings:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let&lt;BR /&gt;&lt;BR /&gt;Source = Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=*" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur...&lt;/A&gt;", [Headers=[Authorization="xxxxxx"]])),&lt;BR /&gt;#"Converti en table" = Table.FromRecords({Source}),&lt;BR /&gt;#"header développé" = Table.ExpandRecordColumn(#"Converti en table", "header", {"statut", "message", "total", "debut", "nombre", "curseur", "curseurSuivant"}),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data = let&lt;BR /&gt;&lt;BR /&gt;Pagination = ((List.Generate(() =&amp;gt; Source,&lt;BR /&gt;each&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;List.Last(&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;_&lt;/STRONG&gt;&lt;/FONT&gt;[curseurSuivant]&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&amp;lt;&amp;gt;null,&lt;BR /&gt;each Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur...&lt;/A&gt;"&amp;amp; List.Last(&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;_&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;[curseurSuivant]), [Headers=[Authorization="xxxxxxx"]]))&lt;BR /&gt;)))&lt;/P&gt;
&lt;P&gt;in&lt;BR /&gt;Pagination,&lt;BR /&gt;#"Converted to Tables" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore)&lt;BR /&gt;in&lt;BR /&gt;#"Converted to Tables"&lt;/P&gt;</description>
    <pubDate>Fri, 20 Aug 2021 15:06:48 GMT</pubDate>
    <dc:creator>ImkeF</dc:creator>
    <dc:date>2021-08-20T15:06:48Z</dc:date>
    <item>
      <title>List.Generate not working</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2026108#M59643</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just reuse a power query code so that I can use an API.&lt;BR /&gt;I thought it was working but I have a problem using List.Generate.&lt;/P&gt;&lt;P&gt;Indeed, I manage to recover my "cursor" and the function manages to increment on the second one but remains blocked on this one.&lt;/P&gt;&lt;P&gt;For example :&lt;/P&gt;&lt;P&gt;When I call the API, I get a first result with # "header développé" [header.curseurSuivant] = AAAAAA&lt;/P&gt;&lt;P&gt;Then comes the first loop which gives me as a result&amp;nbsp;# "header développé" [header.curseurSuivant] = BBBBBBB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for all my other results my # "header développé" [header.curseurSuivant] is the same and is equal to BBBBBB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code that will be more meaningful to you :&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;&lt;BR /&gt;Source = Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=*" target="_blank" rel="noopener"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=*&lt;/A&gt;", [Headers=[Authorization="xxxxxx"]])),&lt;BR /&gt;#"Converti en table" = Table.FromRecords({Source}),&lt;BR /&gt;#"header développé" = Table.ExpandRecordColumn(#"Converti en table", "header", {"statut", "message", "total", "debut", "nombre", "curseur", "curseurSuivant"}, {"header.statut", "header.message", "header.total", "header.debut", "header.nombre", "header.curseur", "header.curseurSuivant"}),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data = let&lt;BR /&gt;&lt;BR /&gt;Pagination = ((List.Generate(() =&amp;gt; Source,&lt;BR /&gt;each #"header développé"[header.curseurSuivant]&amp;lt;&amp;gt;null,&lt;BR /&gt;each Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=" target="_blank" rel="noopener"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=&lt;/A&gt;"&amp;amp; List.Last(#"header développé"[header.curseurSuivant]), [Headers=[Authorization="xxxxxxx"]]))&lt;BR /&gt;)))&lt;/P&gt;&lt;P&gt;in&lt;BR /&gt;Pagination,&lt;BR /&gt;#"Converted to Tables" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore)&lt;BR /&gt;in&lt;BR /&gt;#"Converted to Tables"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to find a solution for me please?&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 12:56:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2026108#M59643</guid>
      <dc:creator>AlexisPREVOT</dc:creator>
      <dc:date>2021-08-19T12:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: List.Generate not working</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2027158#M59644</link>
      <description>&lt;P&gt;You didn't specify the initial value of&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;#"header développé"[header.curseurSuivant]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in the seed. Might also want to use a simple name for that variable.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 02:12:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2027158#M59644</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2021-08-20T02:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: List.Generate not working</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2027604#M59664</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="281974" data-lia-user-login="AlexisPREVOT" class="lia-mention lia-mention-user"&gt;AlexisPREVOT&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;this is because you're alway referencing the first step.&lt;BR /&gt;But List.Generate is usually used to reference the previous step of the current iteration.&lt;BR /&gt;If you use the "each" syntax sugar, you have to use the underscore ("_") to reference the result of the previous iteration:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let&lt;BR /&gt;&lt;BR /&gt;Source = Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=*" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur...&lt;/A&gt;", [Headers=[Authorization="xxxxxx"]])),&lt;BR /&gt;#"Converti en table" = Table.FromRecords({Source}),&lt;BR /&gt;#"header développé" = Table.ExpandRecordColumn(#"Converti en table", "header", {"statut", "message", "total", "debut", "nombre", "curseur", "curseurSuivant"}, {"header.statut", "header.message", "header.total", "header.debut", "header.nombre", "header.curseur", "header.curseurSuivant"}),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data = let&lt;BR /&gt;&lt;BR /&gt;Pagination = ((List.Generate(() =&amp;gt; Source,&lt;BR /&gt;each &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;List.Last(&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;_&lt;/STRONG&gt;&lt;/FONT&gt;[header.curseurSuivant]&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&amp;lt;&amp;gt;null,&lt;BR /&gt;each Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur...&lt;/A&gt;"&amp;amp; List.Last(&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;_&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;[header.curseurSuivant]), [Headers=[Authorization="xxxxxxx"]]))&lt;BR /&gt;)))&lt;/P&gt;
&lt;P&gt;in&lt;BR /&gt;Pagination,&lt;BR /&gt;#"Converted to Tables" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore)&lt;BR /&gt;in&lt;BR /&gt;#"Converted to Tables"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 07:06:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2027604#M59664</guid>
      <dc:creator>ImkeF</dc:creator>
      <dc:date>2021-08-20T07:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: List.Generate not working</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2027653#M59667</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1522" data-lia-user-login="ImkeF" class="lia-mention lia-mention-user"&gt;ImkeF&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your explanations and the code.&lt;BR /&gt;I tried to use it but unfortunately I got an error message telling me that the "header.CurseurSuivant" field of the record could not be found.&lt;/P&gt;&lt;P&gt;Would you please have an idea?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 07:21:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2027653#M59667</guid>
      <dc:creator>AlexisPREVOT</dc:creator>
      <dc:date>2021-08-20T07:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: List.Generate not working</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2028324#M59699</link>
      <description>&lt;P&gt;Oh yes, that was stupid from me. Delete the "header."-part from the strings:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let&lt;BR /&gt;&lt;BR /&gt;Source = Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=*" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur...&lt;/A&gt;", [Headers=[Authorization="xxxxxx"]])),&lt;BR /&gt;#"Converti en table" = Table.FromRecords({Source}),&lt;BR /&gt;#"header développé" = Table.ExpandRecordColumn(#"Converti en table", "header", {"statut", "message", "total", "debut", "nombre", "curseur", "curseurSuivant"}),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data = let&lt;BR /&gt;&lt;BR /&gt;Pagination = ((List.Generate(() =&amp;gt; Source,&lt;BR /&gt;each&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;List.Last(&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;_&lt;/STRONG&gt;&lt;/FONT&gt;[curseurSuivant]&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;&amp;lt;&amp;gt;null,&lt;BR /&gt;each Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=" target="_blank" rel="noopener nofollow noreferrer"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur...&lt;/A&gt;"&amp;amp; List.Last(&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;_&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;[curseurSuivant]), [Headers=[Authorization="xxxxxxx"]]))&lt;BR /&gt;)))&lt;/P&gt;
&lt;P&gt;in&lt;BR /&gt;Pagination,&lt;BR /&gt;#"Converted to Tables" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Ignore)&lt;BR /&gt;in&lt;BR /&gt;#"Converted to Tables"&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 15:06:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2028324#M59699</guid>
      <dc:creator>ImkeF</dc:creator>
      <dc:date>2021-08-20T15:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: List.Generate not working</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2048059#M60267</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="1522" data-lia-user-login="ImkeF" class="lia-mention lia-mention-user"&gt;ImkeF&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies for the delay in responding, but I was on vacation last week.&lt;BR /&gt;I tried your solution this morning but unfortunately I still have the same error message. I do not really know what else to do...&lt;BR /&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="199176" data-lia-user-login="v-yingjl" class="lia-mention lia-mention-user"&gt;v-yingjl&lt;/a&gt;&amp;nbsp;&amp;nbsp;I'm sorry but my problem is still not resolve&lt;/P&gt;</description>
      <pubDate>Tue, 31 Aug 2021 07:52:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2048059#M60267</guid>
      <dc:creator>AlexisPREVOT</dc:creator>
      <dc:date>2021-08-31T07:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: List.Generate not working</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2052845#M60389</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have found a solution at this problem.&lt;/P&gt;&lt;P&gt;I think the code is not necessarily clean but it works.&lt;BR /&gt;if that can help people here is the code:&lt;/P&gt;&lt;P&gt;let pagination = ((List.Generate(() =&amp;gt; [Source = Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=*&amp;amp;nombre=999" target="_blank" rel="noopener"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=*&amp;amp;nombre=999&lt;/A&gt;", [Headers=[Authorization="Bearer XXXX"]])),&lt;BR /&gt;#"Converti en table" = Table.FromRecords({Source}),&lt;BR /&gt;#"header développé" = Table.ExpandRecordColumn(#"Converti en table", "header", {"statut", "message", "total", "debut", "nombre", "curseur", "curseurSuivant"}),&lt;/P&gt;&lt;P&gt;curseurSuivant=#"header développé"[curseurSuivant]],&lt;/P&gt;&lt;P&gt;each List.Last( _[curseurSuivant] )&amp;lt;&amp;gt;null,&lt;/P&gt;&lt;P&gt;each [Source = Json.Document(Web.Contents("&lt;A href="https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=" target="_blank" rel="noopener"&gt;https://api.insee.fr/entreprises/sirene/V3/siren?q=periode(etatAdministratifUniteLegale%3AA)&amp;amp;curseur=&lt;/A&gt;"&amp;amp;List.Last(_[curseurSuivant])&amp;amp;"&amp;amp;nombre=999", [Headers=[Authorization="Bearer XXXX"]])),&lt;BR /&gt;#"Converti en table" = Table.FromRecords({Source}),&lt;BR /&gt;#"header développé" = Table.ExpandRecordColumn(#"Converti en table", "header", {"statut", "message", "total", "debut", "nombre", "curseur", "curseurSuivant"}),&lt;/P&gt;&lt;P&gt;curseurSuivant=#"header développé"[curseurSuivant]]))&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;in&lt;/P&gt;&lt;P&gt;Pagination&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to those who helped me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 05:38:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/List-Generate-not-working/m-p/2052845#M60389</guid>
      <dc:creator>AlexisPREVOT</dc:creator>
      <dc:date>2021-09-02T05:38:06Z</dc:date>
    </item>
  </channel>
</rss>

