<?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 For Loop last Value in Variable Lost in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/For-Loop-last-Value-in-Variable-Lost/m-p/32398#M5472</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have a strange phenomenon. I have in a SharePoint List our Plants which will be connected over the next month to SAP. Therefore i have this following table out of the SharePoint List:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="202399" alt="Support_1.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/202399_Support_1.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the following QV Code (as a picture and as Text) to test the single line output from my for loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="202403" alt="Support_2.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/202403_Support_2.JPG" style="height: 224px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;Dim_Plants_SAP:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Plant_Number,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAP_Company_Code, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num(SAP_seit) as SAP_Datum&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;Q&gt;&lt;/Q&gt;&lt;/P&gt;&lt;P&gt;(qvd) where len(SAP_seit)&amp;gt;=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET NumRowsFilter=NoOfRows('Dim_Plants_SAP');&lt;/P&gt;&lt;P&gt;trace $(NumRowsFilter);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR x=1 to $(NumRowsFilter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;trace $(x);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Bei jedem Schleifendurchlauf werden die Felder "Plant_Number, SAP_Comapny_Code, SAP_Datum" geholt und in eine Variable gespeichert für die spätere Filterung der FACT_SAP_AHC_FI_BOOKINGS.qvd&lt;/P&gt;&lt;P&gt;Let vD_Plant_Number=FieldValue('Plant_Number',$(x));&lt;/P&gt;&lt;P&gt;Let vD_SAP_Company_Code=FieldValue('SAP_Company_Code',$(x));&lt;/P&gt;&lt;P&gt;Let vD_SAP_Datum=FieldValue('SAP_Datum',$(x));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Ausgabe der Variablen im Skript Fenster zur Prüfung&lt;/P&gt;&lt;P&gt;trace $(vD_Plant_Number);&lt;/P&gt;&lt;P&gt;trace $(vD_SAP_Company_Code);&lt;/P&gt;&lt;P&gt;trace $(vD_SAP_Datum);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;trace $(x);&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i execute this you will see under the Debug Mode that i lost the "SAP_Datum" from the last line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="202404" alt="Support_3.JPG" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/202404_Support_3.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;For the the other two lines i will get my "SAP_Datum" with 43221 ande 43160, but for the Plant 37 i lost the "SAP_Datum". But it is in the table you see on the Top and i have no ideas, why the for loop cant resolve me the "SAP_Datum".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I read in the help of QlikView that FieldValue only take distinct Values so for the two lines, they have the same Date, so that the last Date will take from Plant 37 to 24. Which function will work without distinct values?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have anyone an idea for me, what i do wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D.P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 May 2018 08:35:29 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-05-15T08:35:29Z</dc:date>
    <item>
      <title>For Loop last Value in Variable Lost</title>
      <link>https://community.qlik.com/t5/QlikView/For-Loop-last-Value-in-Variable-Lost/m-p/32398#M5472</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have a strange phenomenon. I have in a SharePoint List our Plants which will be connected over the next month to SAP. Therefore i have this following table out of the SharePoint List:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="202399" alt="Support_1.JPG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/202399_Support_1.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the following QV Code (as a picture and as Text) to test the single line output from my for loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="202403" alt="Support_2.JPG" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/202403_Support_2.JPG" style="height: 224px; width: 620px;" /&gt;&lt;/P&gt;&lt;P&gt;Dim_Plants_SAP:&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Plant_Number,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAP_Company_Code, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num(SAP_seit) as SAP_Datum&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&lt;Q&gt;&lt;/Q&gt;&lt;/P&gt;&lt;P&gt;(qvd) where len(SAP_seit)&amp;gt;=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET NumRowsFilter=NoOfRows('Dim_Plants_SAP');&lt;/P&gt;&lt;P&gt;trace $(NumRowsFilter);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FOR x=1 to $(NumRowsFilter)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;trace $(x);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Bei jedem Schleifendurchlauf werden die Felder "Plant_Number, SAP_Comapny_Code, SAP_Datum" geholt und in eine Variable gespeichert für die spätere Filterung der FACT_SAP_AHC_FI_BOOKINGS.qvd&lt;/P&gt;&lt;P&gt;Let vD_Plant_Number=FieldValue('Plant_Number',$(x));&lt;/P&gt;&lt;P&gt;Let vD_SAP_Company_Code=FieldValue('SAP_Company_Code',$(x));&lt;/P&gt;&lt;P&gt;Let vD_SAP_Datum=FieldValue('SAP_Datum',$(x));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Ausgabe der Variablen im Skript Fenster zur Prüfung&lt;/P&gt;&lt;P&gt;trace $(vD_Plant_Number);&lt;/P&gt;&lt;P&gt;trace $(vD_SAP_Company_Code);&lt;/P&gt;&lt;P&gt;trace $(vD_SAP_Datum);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;trace $(x);&lt;/P&gt;&lt;P&gt;next&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i execute this you will see under the Debug Mode that i lost the "SAP_Datum" from the last line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="202404" alt="Support_3.JPG" class="jive-image image-3" src="https://community.qlik.com/legacyfs/online/202404_Support_3.JPG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;For the the other two lines i will get my "SAP_Datum" with 43221 ande 43160, but for the Plant 37 i lost the "SAP_Datum". But it is in the table you see on the Top and i have no ideas, why the for loop cant resolve me the "SAP_Datum".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I read in the help of QlikView that FieldValue only take distinct Values so for the two lines, they have the same Date, so that the last Date will take from Plant 37 to 24. Which function will work without distinct values?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have anyone an idea for me, what i do wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;D.P.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2018 08:35:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/For-Loop-last-Value-in-Variable-Lost/m-p/32398#M5472</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-15T08:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: For Loop last Value in Variable Lost</title>
      <link>https://community.qlik.com/t5/QlikView/For-Loop-last-Value-in-Variable-Lost/m-p/32399#M5473</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found the solution. If someone is interesting in this here it comes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead of the FieldValue() function i used the Peek function. But attention, the Peek() function start the Count with 0 instead of 1 like the FieldValue() function. Here the hole Code snip which will work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Dim_Plants_SAP:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;LOAD&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Plant_Number,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAP_Company_Code,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num(SAP_seit) as SAP_Datum&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;FROM&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;Q&gt;&lt;/Q&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;(qvd) where len(SAP_seit)&amp;gt;=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;LET NumRowsFilter=NoOfRows('Dim_Plants_SAP')-1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;trace $(NumRowsFilter);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;FOR x=0 to $(NumRowsFilter)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;trace $(x);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;//Bei jedem Schleifendurchlauf werden die Felder "Plant_Number, SAP_Comapny_Code, SAP_Datum" geholt und in eine Variable gespeichert für die spätere Filterung der FACT_SAP_AHC_FI_BOOKINGS.qvd&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let vD_Plant_Number=Peek('Plant_Number',$(x),'Dim_Plants_SAP');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let vD_SAP_Company_Code=Peek('SAP_Company_Code',$(x),'Dim_Plants_SAP');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Let vD_SAP_Datum=Peek('SAP_Datum',$(x),'Dim_Plants_SAP');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;//Ausgabe der Variablen im Skript Fenster zur Prüfung&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;trace $(vD_Plant_Number);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;trace $(vD_SAP_Company_Code);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;trace $(vD_SAP_Datum);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;trace $(x);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;next;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;All lines with bold are changed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2018 09:18:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/For-Loop-last-Value-in-Variable-Lost/m-p/32399#M5473</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-15T09:18:25Z</dc:date>
    </item>
  </channel>
</rss>

