<?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 Script condition; keeping current data in the document in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Script-condition-keeping-current-data-in-the-document/m-p/214240#M67795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to create a condition in the script;&lt;/P&gt;&lt;P&gt;If the result was true, load data from database&lt;/P&gt;&lt;P&gt;Else, keep the current data in the document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script could be like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If &amp;lt;CONDITION&amp;gt; then&lt;/P&gt;&lt;P&gt;Load … from ...&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;// keep current data in the document&lt;/P&gt;&lt;P&gt;End if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you help me please to create this script?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Yacine&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 13 Feb 2011 14:19:35 GMT</pubDate>
    <dc:creator>yacine_b</dc:creator>
    <dc:date>2011-02-13T14:19:35Z</dc:date>
    <item>
      <title>Script condition; keeping current data in the document</title>
      <link>https://community.qlik.com/t5/QlikView/Script-condition-keeping-current-data-in-the-document/m-p/214240#M67795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to create a condition in the script;&lt;/P&gt;&lt;P&gt;If the result was true, load data from database&lt;/P&gt;&lt;P&gt;Else, keep the current data in the document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script could be like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If &amp;lt;CONDITION&amp;gt; then&lt;/P&gt;&lt;P&gt;Load … from ...&lt;/P&gt;&lt;P&gt;Else&lt;/P&gt;&lt;P&gt;// keep current data in the document&lt;/P&gt;&lt;P&gt;End if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you help me please to create this script?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Yacine&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Feb 2011 14:19:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-condition-keeping-current-data-in-the-document/m-p/214240#M67795</guid>
      <dc:creator>yacine_b</dc:creator>
      <dc:date>2011-02-13T14:19:35Z</dc:date>
    </item>
    <item>
      <title>Script condition; keeping current data in the document</title>
      <link>https://community.qlik.com/t5/QlikView/Script-condition-keeping-current-data-in-the-document/m-p/214241#M67796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the solution.&lt;/P&gt;&lt;P&gt;I added "Binary &amp;lt;the current document path&amp;gt;" in the top of the script&lt;/P&gt;&lt;P&gt;That's all&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Feb 2011 15:36:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-condition-keeping-current-data-in-the-document/m-p/214241#M67796</guid>
      <dc:creator>yacine_b</dc:creator>
      <dc:date>2011-02-13T15:36:25Z</dc:date>
    </item>
    <item>
      <title>Script condition; keeping current data in the document</title>
      <link>https://community.qlik.com/t5/QlikView/Script-condition-keeping-current-data-in-the-document/m-p/214242#M67797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But this has nothing to do with your first query?&lt;/P&gt;&lt;P&gt;Your approach to the script is correct, as conditions you may hardcode a certain age of the file to read, or number of records. You may also store the filetime of the last load into a variable and then do the comparison to find out, whether the current file is newer.&lt;BR /&gt;The ELSE-condition may also contain an EXIT SCRIPT - thus no refresh.&lt;/P&gt;&lt;P&gt;Your code then may look like&lt;BR /&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;LET sFile = 'YourFile';&lt;BR /&gt;IF dLastFileDate &amp;lt; FILETIME($(sFile)) THEN&lt;BR /&gt;LOAD * FROM $(sFile);&lt;BR /&gt;ELSE&lt;BR /&gt;EXIT SCRIPT;&lt;BR /&gt;END IF;&lt;BR /&gt;LET dLastFileDate = FILETIME($(sFile));&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;HTH&lt;BR /&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Feb 2011 21:51:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-condition-keeping-current-data-in-the-document/m-p/214242#M67797</guid>
      <dc:creator>prieper</dc:creator>
      <dc:date>2011-02-13T21:51:42Z</dc:date>
    </item>
  </channel>
</rss>

