<?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: Change the variable value in the load in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445211#M166053</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Setting a variable needs to be done by SET and you do not need the $. So it should be something along:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If previous(field) &amp;lt;&amp;gt; field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET variable = 1;&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Oct 2012 15:41:53 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-10-23T15:41:53Z</dc:date>
    <item>
      <title>Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445210#M166052</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to change the variable value in the load statement,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(previous(field)&amp;lt;&amp;gt;field,$(variable)=1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it doesn't work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 15:38:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445210#M166052</guid>
      <dc:creator />
      <dc:date>2012-10-23T15:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445211#M166053</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Setting a variable needs to be done by SET and you do not need the $. So it should be something along:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If previous(field) &amp;lt;&amp;gt; field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SET variable = 1;&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 15:41:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445211#M166053</guid>
      <dc:creator />
      <dc:date>2012-10-23T15:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445212#M166054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank's for your answer, but I need to change it in a load statement, so in a if(condition,expression) not in ordinary if then end if.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 15:45:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445212#M166054</guid>
      <dc:creator />
      <dc:date>2012-10-23T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445213#M166055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I think it makes sense what you want to do, just what you create is a field where you put that value as your table will have multiple records, you will not create a variable for each record, no?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;if(previous(field)&amp;lt;&amp;gt;field,1,0) as NEWFIELD;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 15:50:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445213#M166055</guid>
      <dc:creator />
      <dc:date>2012-10-23T15:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445214#M166056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean with "in a load statement" as a field:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD col1 as a, col2 as b, if(condition, expression) as c FROM ...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This cannot be done I think. May'be you could give some more information on what you are trying to achieve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 15:50:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445214#M166056</guid>
      <dc:creator />
      <dc:date>2012-10-23T15:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445215#M166057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ducati, this can be done in a load statement exactly as you specifiy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD Col1, Col2, Col3, IF(Col1=Previous(Col1),'YES','NO') as Col1IsTheSame FROM.........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And Christine is correct, it doesn't make sense creating a variable in a load statement, a variable can only ever hold one value, not an array of values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 15:57:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445215#M166057</guid>
      <dc:creator />
      <dc:date>2012-10-23T15:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445216#M166058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I perhaps wasn't clear, here you are my load statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; font-size: 10pt;"&gt;&lt;A&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13510078725817937" jivemacro_uid="_13510078725817937"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ruptures:&lt;/P&gt;&lt;P&gt;//if(previous([Code SAP])&amp;lt;&amp;gt;[Code SAP] or previous([Centre de distribution rupture])&amp;lt;&amp;gt;[Centre de distribution rupture]) then $(vCount)=1&lt;/P&gt;&lt;P&gt;LOAD Date, &lt;/P&gt;&lt;P&gt;&amp;nbsp; [Code SAP],&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Centre de distribution rupture], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(num(previous(Date))=num(Date)-1 and previous([Code SAP])=[Code SAP] and previous([Centre de distribution rupture])=[Centre de distribution rupture],$(vCount)+1,$(vCount)) as nbRupture,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(previous([Code SAP])&amp;lt;&amp;gt;[Code SAP] or previous([Centre de distribution rupture])&amp;lt;&amp;gt;[Centre de distribution rupture],set vCount=1),&lt;/P&gt;&lt;P&gt;&amp;nbsp; numLigne,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Code GMID], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Stock à date], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [SLA MIN], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [SLA MAX], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Code usine], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Coordinateur logistique rupture], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Catégorie produit], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Responsabilité, &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Semaine prévisionnelle de fin de rupture], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Codes Commentaires], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Commentaire libre],&lt;/P&gt;&lt;P&gt;&amp;nbsp; [Commentaires automatiques], &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cause&lt;/P&gt;&lt;P&gt;Resident Ruptures_temp&lt;/P&gt;&lt;P&gt;order by [Code SAP],[Centre de distribution rupture],Date;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I would like to compare previous values, if it change, the variable has to take 1 as value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 15:59:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445216#M166058</guid>
      <dc:creator />
      <dc:date>2012-10-23T15:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445217#M166059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want that the field take the variable value, and if the previous product isn't the product of my current record, I want to reset the variable value to 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thak's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 16:07:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445217#M166059</guid>
      <dc:creator />
      <dc:date>2012-10-23T16:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445218#M166060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is exactly our point though, you really dont want to create a variable, you want to create a column.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;This column becomes part of your table and has a value of 1 if the current row in the table has the same value as the previous row for Code SAP.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;You cannot do this with a variable because it holds only one value, therefore the value of vCount will either be zero or 1 at the end of processing, so my previous comment and load script statement still stands.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Now.....&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;If you then want to have to total number of rows in your table that have the same previous value, that is different, you could then add the following:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;AggrTable:&lt;/P&gt;&lt;P&gt;LOAD Sum(YourColumnNameOfCount) AS SumOfCount RESIDENT Ruptures;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LET vCount = PEEK('AggrTable','SumOfCount',0);&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DROP TABLE AggrTable;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;This will then give you a variable then holds the total number of rows in your table that have the same prevoius value.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 16:11:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445218#M166060</guid>
      <dc:creator />
      <dc:date>2012-10-23T16:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445219#M166061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, now I think I understand you, I think what you want is that when the value of Code SAP is new, the value of the column should be 1, and for each row that it remains the same, the value of the column should increment, then when the value changes again, it should revert back to 1. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If my understanding is correct then you can do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ruptures:&lt;/P&gt;&lt;P&gt;LOAD *, IF(nbRupture=1,Peek('nbRuptureNew')+1,1) as nbRuptureNew;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD Date, &lt;/P&gt;&lt;P&gt;[Code SAP],&lt;/P&gt;&lt;P&gt;[Centre de distribution rupture], &lt;/P&gt;&lt;P&gt;if(num(previous(Date))=num(Date)-1 and previous([Code SAP])=[Code SAP] and previous([Centre de distribution rupture])=[Centre de distribution rupture],1,0) as nbRupture,&lt;/P&gt;&lt;P&gt;etc&lt;/P&gt;&lt;P&gt;etc&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2012 16:30:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445219#M166061</guid>
      <dc:creator />
      <dc:date>2012-10-23T16:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445220#M166062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works, Thank you Nigel &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 07:25:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445220#M166062</guid>
      <dc:creator />
      <dc:date>2012-10-24T07:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Change the variable value in the load</title>
      <link>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445221#M166063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My pleasure&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2012 07:33:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Change-the-variable-value-in-the-load/m-p/445221#M166063</guid>
      <dc:creator />
      <dc:date>2012-10-24T07:33:18Z</dc:date>
    </item>
  </channel>
</rss>

