<?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 load on condition in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1795957#M1211206</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;The requirement I have is to load the part of the script on condition. If status = In Progress, then the further script should not load, else the further script shall execute.&amp;nbsp; The issue is even if the status is in progress, the exit script is not working and the load statement in else condition is getting execute. Please advise.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the below is my script -&amp;nbsp;&lt;/P&gt;&lt;P&gt;----- OLE DB connection string ------&lt;/P&gt;&lt;P&gt;JobStatus:&lt;/P&gt;&lt;P&gt;select status from table1;&lt;/P&gt;&lt;P&gt;let vStatus = fieldvalue('status', 'In Progress') ;&lt;/P&gt;&lt;P&gt;If ('$(vStatus)' =&amp;nbsp; 'In Progress') then&lt;/P&gt;&lt;P&gt;Exit Script;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;-----LOAD statements ----&lt;/P&gt;&lt;P&gt;End IF;&lt;/P&gt;</description>
    <pubDate>Wed, 31 Mar 2021 10:35:52 GMT</pubDate>
    <dc:creator>sk88024</dc:creator>
    <dc:date>2021-03-31T10:35:52Z</dc:date>
    <item>
      <title>Script load on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1795957#M1211206</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;The requirement I have is to load the part of the script on condition. If status = In Progress, then the further script should not load, else the further script shall execute.&amp;nbsp; The issue is even if the status is in progress, the exit script is not working and the load statement in else condition is getting execute. Please advise.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the below is my script -&amp;nbsp;&lt;/P&gt;&lt;P&gt;----- OLE DB connection string ------&lt;/P&gt;&lt;P&gt;JobStatus:&lt;/P&gt;&lt;P&gt;select status from table1;&lt;/P&gt;&lt;P&gt;let vStatus = fieldvalue('status', 'In Progress') ;&lt;/P&gt;&lt;P&gt;If ('$(vStatus)' =&amp;nbsp; 'In Progress') then&lt;/P&gt;&lt;P&gt;Exit Script;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;-----LOAD statements ----&lt;/P&gt;&lt;P&gt;End IF;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 10:35:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1795957#M1211206</guid>
      <dc:creator>sk88024</dc:creator>
      <dc:date>2021-03-31T10:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script load on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1796064#M1211221</link>
      <description>&lt;P&gt;Fieldvalue() isn't correct applied because it expects the fieldvalue-index as second parameter and therefore your variable-assignment should be look like:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;let vStatus = fieldvalue('status', 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;... assuming that there is really just one record.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Marcus&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 14:35:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1796064#M1211221</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-03-31T14:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script load on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1796201#M1211252</link>
      <description>&lt;P&gt;yes, the field Status is having just one record in QV.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have changed the filedvalue parameter, as suggested. However, it's still not working. Still, even though the status is 'In Progress', the load statement after exit script is getting load. Any help would be really appreciable. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 20:18:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1796201#M1211252</guid>
      <dc:creator>sk88024</dc:creator>
      <dc:date>2021-03-31T20:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Script load on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1796210#M1211254</link>
      <description>&lt;P&gt;Something like this &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/85294"&gt;@sk88024&lt;/a&gt;&amp;nbsp;?&lt;/P&gt;&lt;P&gt;JobStatus:&lt;BR /&gt;//select status from table1;&lt;BR /&gt;load&lt;BR /&gt;'In Progress' as status&lt;BR /&gt;autogenerate(1);&lt;/P&gt;&lt;P&gt;let vStatus = peek('status', 0, 'JobStatus') ;&lt;/P&gt;&lt;P&gt;If ('$(vStatus)' =&amp;nbsp; 'In Progress') then&lt;/P&gt;&lt;P&gt;Exit Script;&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;load&lt;BR /&gt;'In Progress 2' as status2&lt;BR /&gt;autogenerate(1);&lt;/P&gt;&lt;P&gt;End IF;&lt;/P&gt;&lt;P&gt;drop table JobStatus;&lt;BR /&gt;exit script;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 20:32:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1796210#M1211254</guid>
      <dc:creator>QFabian</dc:creator>
      <dc:date>2021-03-31T20:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script load on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1796270#M1211265</link>
      <description>&lt;P&gt;You need to check the value, for example with:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;let vStatus = &lt;STRONG&gt;text&lt;/STRONG&gt;(fieldvalue('status', 1));&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG&gt;TRACE&lt;/STRONG&gt; '$(vStatus)';&lt;/P&gt;&lt;P&gt;because Qlik is case-sensitive and each difference to your comparing-value will lead to a mismatch. There could be also any other chars like additionally spaces or similar. Thinkable is also that your value isn't a string (you may see one if you look within your database) else a numeric value. Text() is added to display a visible value because fieldvalue() hasn't a string-representation and looking on it returns usually just ? as a replacement - but it's not the stored value.&lt;/P&gt;&lt;P&gt;Regarding to the above you may need some adjustments to your comparing-value and/or transforming the database-value with functions like: trim(), keepchar(), replace(), upper() or similar.&lt;/P&gt;&lt;P&gt;Beside this fieldvalue() accessed the field and not your loaded table. If you has anywhere before loaded a field status you couldn't access a certain value anymore - in this case you need to change the approach to peek() like demonstrated from QFabian.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 06:17:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Script-load-on-condition/m-p/1796270#M1211265</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2021-04-01T06:17:12Z</dc:date>
    </item>
  </channel>
</rss>

