<?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: Peek statement does not update with API call in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Peek-statement-does-not-update-with-API-call/m-p/2470110#M99593</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/230731"&gt;@ruanh_ad&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Your problem is probably on your Peek function. Add the name of the table and you should be good.&lt;BR /&gt;&lt;SPAN&gt;LET AppID=Peek('AppID',$(i),'Apps');&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My guess is the Peek function is getting the AppID field from the Lineage table instead of Apps table.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I personally prefer using For Each. Following my version of the code:&lt;/P&gt;
&lt;PRE&gt;TempApps:
LOAD * INLINE [
AppIDLoop
07cec6fe-8e05-4c2a-a56c-1e5dd466cd64
36c424a7-24c2-4a68-8305-459fb6b4ee16
65ea54a6-bd81-4b28-8a83-7cdb7dd57c81
];

For Each vAppID In FieldValueList('AppIDLoop')

    LIB CONNECT TO 'Get Lineage';

    Lineage:
    LOAD 
    	discriminator,
        '$(vAppID)' AS AppID
	;
    SQL SELECT 
        "discriminator"
    FROM JSON (wrap on) "root"
    WITH CONNECTION (
        URL "https://mytennant.qlikcloud.com/api/v1/apps/$(vAppID)/data/lineage"
    );

	DISCONNECT;

	Trace App Lineage Loaded: $(vAppID);

NEXT vAppID;

DROP TABLE TempApps;&lt;/PRE&gt;
&lt;P&gt;Make sure your REST Connection have the check Allow With Connection enabled.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marksouzacosta_0-1720724944356.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/169278iEB266CDF4A89298E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marksouzacosta_0-1720724944356.png" alt="marksouzacosta_0-1720724944356.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2024 19:11:54 GMT</pubDate>
    <dc:creator>marksouzacosta</dc:creator>
    <dc:date>2024-07-11T19:11:54Z</dc:date>
    <item>
      <title>Peek statement does not update with API call</title>
      <link>https://community.qlik.com/t5/App-Development/Peek-statement-does-not-update-with-API-call/m-p/2470104#M99590</link>
      <description>&lt;P&gt;I run the following code:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;Apps:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;LOAD * INLINE [&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;AppID&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;dfg9e1-cd7d-4f49-b978-80&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;fdgd9-9849-40d9-bbdb-a3&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;afc096d4-62be-4cb8-9b8f-2f&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;dfgdfg2ce2-e833-419b-8c0a-a9&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;];&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;LIB CONNECT TO 'ADM:REST_APPS';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;FOR i=0 to NoOfRows('Apps')-1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;LET AppID=Peek('AppID',$(i));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Lineage:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;LOAD *,'$(AppID)' as AppID&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;SQL SELECT "discriminator"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;FROM JSON (wrap on) "root"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;WITH CONNECTION ( &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;URL "https://$(vu_tenant_fqdn)/api/v1/apps/$(AppID)/data/Lineage"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;Trace App Lineage[$(i)]: $(AppID);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#3366FF"&gt;NEXT i;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I run this code without the SQL (without the red portion) it works perfectly and gets the right appID.&lt;/P&gt;
&lt;P&gt;When I run the code with all the SQL call it only runs it for the 1st AppID (4 times in this case)&lt;/P&gt;
&lt;P&gt;I'm wondering if it has something to do with async or something?&lt;/P&gt;
&lt;P&gt;I have even tried using the sleep statement, but with no change though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just wondering if anybody has encountered the same issue and has a work around.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 18:44:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Peek-statement-does-not-update-with-API-call/m-p/2470104#M99590</guid>
      <dc:creator>ruanh_ad</dc:creator>
      <dc:date>2024-07-11T18:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Peek statement does not update with API call</title>
      <link>https://community.qlik.com/t5/App-Development/Peek-statement-does-not-update-with-API-call/m-p/2470108#M99592</link>
      <description>&lt;P&gt;I changed this line in the code and seems to be working, if anyone else encounters the issue.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;LET AppID=Peek('AppID',$(i),&lt;STRONG&gt;'Apps'&lt;/STRONG&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I added the tablename, even though that was the whole script and there was no other data in the app.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 19:06:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Peek-statement-does-not-update-with-API-call/m-p/2470108#M99592</guid>
      <dc:creator>ruanh_ad</dc:creator>
      <dc:date>2024-07-11T19:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: Peek statement does not update with API call</title>
      <link>https://community.qlik.com/t5/App-Development/Peek-statement-does-not-update-with-API-call/m-p/2470110#M99593</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/230731"&gt;@ruanh_ad&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Your problem is probably on your Peek function. Add the name of the table and you should be good.&lt;BR /&gt;&lt;SPAN&gt;LET AppID=Peek('AppID',$(i),'Apps');&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;My guess is the Peek function is getting the AppID field from the Lineage table instead of Apps table.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I personally prefer using For Each. Following my version of the code:&lt;/P&gt;
&lt;PRE&gt;TempApps:
LOAD * INLINE [
AppIDLoop
07cec6fe-8e05-4c2a-a56c-1e5dd466cd64
36c424a7-24c2-4a68-8305-459fb6b4ee16
65ea54a6-bd81-4b28-8a83-7cdb7dd57c81
];

For Each vAppID In FieldValueList('AppIDLoop')

    LIB CONNECT TO 'Get Lineage';

    Lineage:
    LOAD 
    	discriminator,
        '$(vAppID)' AS AppID
	;
    SQL SELECT 
        "discriminator"
    FROM JSON (wrap on) "root"
    WITH CONNECTION (
        URL "https://mytennant.qlikcloud.com/api/v1/apps/$(vAppID)/data/lineage"
    );

	DISCONNECT;

	Trace App Lineage Loaded: $(vAppID);

NEXT vAppID;

DROP TABLE TempApps;&lt;/PRE&gt;
&lt;P&gt;Make sure your REST Connection have the check Allow With Connection enabled.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="marksouzacosta_0-1720724944356.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/169278iEB266CDF4A89298E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="marksouzacosta_0-1720724944356.png" alt="marksouzacosta_0-1720724944356.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 19:11:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Peek-statement-does-not-update-with-API-call/m-p/2470110#M99593</guid>
      <dc:creator>marksouzacosta</dc:creator>
      <dc:date>2024-07-11T19:11:54Z</dc:date>
    </item>
  </channel>
</rss>

