<?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 How can i keep the conditon for sql statement in the script based on other value? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-can-i-keep-the-conditon-for-sql-statement-in-the-script/m-p/205552#M61979</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;- I had taken a table from database and created a qvd file for particular table. The qvd and table has same number of rows. Now i want to update qvd file if i inserted some records in the database. For that i written a script as follows:&lt;BR /&gt;&lt;BR /&gt;//Test:&lt;BR /&gt;//LOAD Id,&lt;BR /&gt;// Sname,&lt;BR /&gt;// Sal;&lt;BR /&gt;//SQL SELECT *&lt;BR /&gt;//FROM QvdUpdate.dbo.Test;&lt;BR /&gt;//STORE Test into Test.qvd;&lt;BR /&gt;&lt;BR /&gt;TestFile:&lt;BR /&gt;SQL SELECT Id,&lt;BR /&gt; Sal,&lt;BR /&gt; Sname&lt;BR /&gt;FROM QvdUpdate.dbo.Test where id &amp;gt; 7;&lt;BR /&gt;Concatenate&lt;BR /&gt;LOAD Id,&lt;BR /&gt; Sname,&lt;BR /&gt; Sal&lt;BR /&gt;FROM&lt;BR /&gt;Test.qvd&lt;BR /&gt;(qvd);&lt;BR /&gt;STORE TestFile into Test.qvd;&lt;BR /&gt;&lt;BR /&gt;- The qvd is Updating with this code. But in the sql statement i have given the conditon manually with the value i.e 7.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;- In the place of 7 i want to put max(id)(i.e the last record value of the qvd file) value which is coming from qvd file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 08 Apr 2011 13:16:13 GMT</pubDate>
    <dc:creator>jagannalla</dc:creator>
    <dc:date>2011-04-08T13:16:13Z</dc:date>
    <item>
      <title>How can i keep the conditon for sql statement in the script based on other value?</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-i-keep-the-conditon-for-sql-statement-in-the-script/m-p/205552#M61979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;- I had taken a table from database and created a qvd file for particular table. The qvd and table has same number of rows. Now i want to update qvd file if i inserted some records in the database. For that i written a script as follows:&lt;BR /&gt;&lt;BR /&gt;//Test:&lt;BR /&gt;//LOAD Id,&lt;BR /&gt;// Sname,&lt;BR /&gt;// Sal;&lt;BR /&gt;//SQL SELECT *&lt;BR /&gt;//FROM QvdUpdate.dbo.Test;&lt;BR /&gt;//STORE Test into Test.qvd;&lt;BR /&gt;&lt;BR /&gt;TestFile:&lt;BR /&gt;SQL SELECT Id,&lt;BR /&gt; Sal,&lt;BR /&gt; Sname&lt;BR /&gt;FROM QvdUpdate.dbo.Test where id &amp;gt; 7;&lt;BR /&gt;Concatenate&lt;BR /&gt;LOAD Id,&lt;BR /&gt; Sname,&lt;BR /&gt; Sal&lt;BR /&gt;FROM&lt;BR /&gt;Test.qvd&lt;BR /&gt;(qvd);&lt;BR /&gt;STORE TestFile into Test.qvd;&lt;BR /&gt;&lt;BR /&gt;- The qvd is Updating with this code. But in the sql statement i have given the conditon manually with the value i.e 7.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;- In the place of 7 i want to put max(id)(i.e the last record value of the qvd file) value which is coming from qvd file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2011 13:16:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-i-keep-the-conditon-for-sql-statement-in-the-script/m-p/205552#M61979</guid>
      <dc:creator>jagannalla</dc:creator>
      <dc:date>2011-04-08T13:16:13Z</dc:date>
    </item>
    <item>
      <title>How can i keep the conditon for sql statement in the script based on other value?</title>
      <link>https://community.qlik.com/t5/QlikView/How-can-i-keep-the-conditon-for-sql-statement-in-the-script/m-p/205553#M61980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;give the following code a try. This is how I do it.&lt;/P&gt;&lt;P&gt;// first read from qvd and find max id&lt;/P&gt;&lt;P&gt;loadData:&lt;BR /&gt;LOAD Id,&lt;BR /&gt; Sname,&lt;BR /&gt; Sal&lt;BR /&gt;FROM&lt;BR /&gt;Test.qvd&lt;BR /&gt;(qvd);&lt;/P&gt;&lt;P&gt;maxId:&lt;BR /&gt;select max(Id) as maxId&lt;BR /&gt;resident loadData;&lt;/P&gt;&lt;P&gt;let vmaxId=peek('maxId',-1,maxId);&lt;/P&gt;&lt;P&gt;drop table maxId;&lt;/P&gt;&lt;P&gt;// now do a concatenate laod frolm your databse for everything above the maxId&lt;BR /&gt;loadData:&lt;BR /&gt;Concatenate (loadData)&lt;BR /&gt;LOAD Id,&lt;BR /&gt; Sname,&lt;BR /&gt; Sal;&lt;/P&gt;&lt;P&gt;loadData:&lt;BR /&gt;SQL SELECT Id,&lt;BR /&gt; Sal,&lt;BR /&gt; Sname&lt;BR /&gt;FROM QvdUpdate.dbo.Test where id &amp;gt; $(vmaxId);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;STORE loadData into Test.qvd;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Apr 2011 13:23:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-can-i-keep-the-conditon-for-sql-statement-in-the-script/m-p/205553#M61980</guid>
      <dc:creator>pat_agen</dc:creator>
      <dc:date>2011-04-08T13:23:54Z</dc:date>
    </item>
  </channel>
</rss>

