<?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 Variable to SQL in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-to-SQL/m-p/1728251#M452145</link>
    <description>&lt;P&gt;Hi Community, getting crazy. This have worked earlier.&lt;/P&gt;&lt;P&gt;Got this first to get the highest nuber from a time field in database:&lt;BR /&gt;&lt;BR /&gt;Load&lt;BR /&gt;NUM(MAXTID) as MAXTID;&lt;BR /&gt;SELECT max(R2PTIM) as MAXTID from TABLE where R2CMP = '222' and R2PDAT &amp;gt;= current_date;&lt;BR /&gt;LET VLastUp = MAXTID;&lt;/P&gt;&lt;P&gt;Load&lt;BR /&gt;NUM(MAXTID) as MAXTID;&lt;BR /&gt;SELECT max(R2PTIM) as MAXTID from CLICFILPRD.RKNRP200 where R2CMP = '222' and R2PDAT &amp;gt;= current_date;&lt;BR /&gt;LET VLastUp = MAXTID; in variable&lt;/P&gt;&lt;P&gt;Then i want to use this VLastUp in the next SQL in script:&lt;BR /&gt;&lt;BR /&gt;SELECT * from Table where R2CMP = '222' and R2PDAT &amp;gt;= current_date and R2PTIM &amp;gt; '$(VLastUp)';&lt;/P&gt;&lt;P&gt;Just want to store the highest time in Variable, then nest reolad, just show me the post with higher time than the last time and so on&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;P&gt;Can't get this to work.&lt;/P&gt;&lt;P&gt;R2PTIM is time in DB i think, like this 105 811&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jul 2020 05:52:38 GMT</pubDate>
    <dc:creator>johnan</dc:creator>
    <dc:date>2020-07-16T05:52:38Z</dc:date>
    <item>
      <title>Variable to SQL</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-to-SQL/m-p/1728251#M452145</link>
      <description>&lt;P&gt;Hi Community, getting crazy. This have worked earlier.&lt;/P&gt;&lt;P&gt;Got this first to get the highest nuber from a time field in database:&lt;BR /&gt;&lt;BR /&gt;Load&lt;BR /&gt;NUM(MAXTID) as MAXTID;&lt;BR /&gt;SELECT max(R2PTIM) as MAXTID from TABLE where R2CMP = '222' and R2PDAT &amp;gt;= current_date;&lt;BR /&gt;LET VLastUp = MAXTID;&lt;/P&gt;&lt;P&gt;Load&lt;BR /&gt;NUM(MAXTID) as MAXTID;&lt;BR /&gt;SELECT max(R2PTIM) as MAXTID from CLICFILPRD.RKNRP200 where R2CMP = '222' and R2PDAT &amp;gt;= current_date;&lt;BR /&gt;LET VLastUp = MAXTID; in variable&lt;/P&gt;&lt;P&gt;Then i want to use this VLastUp in the next SQL in script:&lt;BR /&gt;&lt;BR /&gt;SELECT * from Table where R2CMP = '222' and R2PDAT &amp;gt;= current_date and R2PTIM &amp;gt; '$(VLastUp)';&lt;/P&gt;&lt;P&gt;Just want to store the highest time in Variable, then nest reolad, just show me the post with higher time than the last time and so on&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;P&gt;Can't get this to work.&lt;/P&gt;&lt;P&gt;R2PTIM is time in DB i think, like this 105 811&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jul 2020 05:52:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-to-SQL/m-p/1728251#M452145</guid>
      <dc:creator>johnan</dc:creator>
      <dc:date>2020-07-16T05:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Variable to SQL</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-to-SQL/m-p/1728351#M452155</link>
      <description>The syntax you posted is correct and it should work, provided VLastUp and R2PTIM have the same format, else the condition will never be met and the results returned would not be the expected ones.&lt;BR /&gt;&lt;BR /&gt;Make sure VLastUp displays its value with the same format than R2PTIM. You can use TRACE '$(VLastUp)'; in your script to see the format it takes when the script runs and troubleshoot.</description>
      <pubDate>Thu, 16 Jul 2020 09:53:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-to-SQL/m-p/1728351#M452155</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2020-07-16T09:53:51Z</dc:date>
    </item>
  </channel>
</rss>

