<?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: For Loop and saving using field value in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996985#M82561</link>
    <description>&lt;P&gt;Hi, i don't think you need the loop, just do:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD distinct SHOPNAME From/resident...&lt;/LI-CODE&gt;
&lt;P&gt;Another option could be&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD SHOPNAME From/resident... where not Exists(SHOPNAME);&lt;/LI-CODE&gt;
&lt;P&gt;So you have a table with the diffrent values, and you can store it to qvd.&lt;/P&gt;</description>
    <pubDate>Wed, 26 Oct 2022 09:49:34 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2022-10-26T09:49:34Z</dc:date>
    <item>
      <title>For Loop and saving using field value</title>
      <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996945#M82560</link>
      <description>&lt;P&gt;Hello, I have a field name SHOPCODE and SHOPNAME. When I try to use Load distinct SHOPCODE, there will be 40 values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I get the name of those 40 unique values and save it using for loop with the name of the unique value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like this:&lt;/P&gt;
&lt;P&gt;SHOPTABLE:&lt;/P&gt;
&lt;P&gt;for NumberOFShop = SHOPCODE&lt;/P&gt;
&lt;P&gt;Load SHOPNAME&lt;/P&gt;
&lt;P&gt;STORE * FROM&amp;nbsp;SHOPTABLE INTO [lib://SHOPCODE.QVD];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SHOPCODE.QVD should be the name of the value from the SHOPCODE field.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 08:20:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996945#M82560</guid>
      <dc:creator>bryan_21</dc:creator>
      <dc:date>2022-10-26T08:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop and saving using field value</title>
      <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996985#M82561</link>
      <description>&lt;P&gt;Hi, i don't think you need the loop, just do:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD distinct SHOPNAME From/resident...&lt;/LI-CODE&gt;
&lt;P&gt;Another option could be&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;LOAD SHOPNAME From/resident... where not Exists(SHOPNAME);&lt;/LI-CODE&gt;
&lt;P&gt;So you have a table with the diffrent values, and you can store it to qvd.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 09:49:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996985#M82561</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-10-26T09:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop and saving using field value</title>
      <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996993#M82562</link>
      <description>&lt;P&gt;I want to get the value of the field SHOPCODE so that all of those will be named after the value.&lt;/P&gt;
&lt;P&gt;Sample:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SHOPCODE, SHOPNAME&lt;/P&gt;
&lt;P&gt;1, aa&lt;/P&gt;
&lt;P&gt;2, bb&lt;/P&gt;
&lt;P&gt;3, cc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The file name of the qvd will be the value from the SHOPCODE therefore based on the sample there will be 3 QVD to be save with data from the SHOPNAME field. Thats what I would like to happen.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 09:58:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996993#M82562</guid>
      <dc:creator>bryan_21</dc:creator>
      <dc:date>2022-10-26T09:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop and saving using field value</title>
      <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996998#M82563</link>
      <description>&lt;P&gt;Hi, then after you have the table ith all distint values you can iterate using:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;FOR i=0 to NoOfRows('TableName')-1
  LET vShopCode=Peek('SHOPCODE',$(i),'TableName');
  ...
NEXT&lt;/LI-CODE&gt;
&lt;P&gt;In each iteration of the bucle, the variable vShopCode will have the code of the shop, so you use it to name the qvd or as a filter in querys.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 10:04:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1996998#M82563</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-10-26T10:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop and saving using field value</title>
      <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1997004#M82564</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/196490"&gt;@bryan_21&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You can try the following.&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Shop:
LOAD
     SHOPCODE
     ,SHOPNAME
     ,ADDITIONAL_FIELDS_IF_NEEDED
FROM SOURCE ...
;

FOR EACH i IN FieldValueList('SHOPNAME')
SET vShopName = '$(i)';

NOCONCATENATE
[$(vShopName)]:
LOAD *
RESIDENT Shop
WHERE SHOPNAME = '$(vShopName)'
;
STORE $(vShopName) INTO [lib://SHOP/$(vShopName).QVD]
;
DROP TABLE $(vShopName)
;

NEXT i

DROP TABLE Shop
;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 26 Oct 2022 10:11:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1997004#M82564</guid>
      <dc:creator>Ruhulessin</dc:creator>
      <dc:date>2022-10-26T10:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop and saving using field value</title>
      <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1997018#M82565</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/34638"&gt;@Ruhulessin&lt;/a&gt;&amp;nbsp; and&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22593"&gt;@rubenmarin&lt;/a&gt;&amp;nbsp;! Glad you've replied to my query.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 10:30:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1997018#M82565</guid>
      <dc:creator>bryan_21</dc:creator>
      <dc:date>2022-10-26T10:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop and saving using field value</title>
      <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1997036#M82566</link>
      <description>&lt;P&gt;Glad to be of help!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2022 11:09:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1997036#M82566</guid>
      <dc:creator>Ruhulessin</dc:creator>
      <dc:date>2022-10-26T11:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop and saving using field value</title>
      <link>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1997345#M82594</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/22593"&gt;@rubenmarin&lt;/a&gt;&amp;nbsp; &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/34638"&gt;@Ruhulessin&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just have additional query that I hope you can be of help.&lt;/P&gt;
&lt;P&gt;Now I have additional fields that I want to add aside from the SHOPCODE and SHOPNAME which is the PRODUCTCODE and QTY. How do you sum the values of QTY with same PRODUCTCODE?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fields will be SHOPCODE, SHOPNAME, PRODUCTCODE and SALESQTY.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2022 03:30:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/For-Loop-and-saving-using-field-value/m-p/1997345#M82594</guid>
      <dc:creator>bryan_21</dc:creator>
      <dc:date>2022-10-27T03:30:09Z</dc:date>
    </item>
  </channel>
</rss>

