<?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: Force script to fail based on condition in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372403#M820247</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to make the script fail the do something like loading data from a non-existent table:&lt;/P&gt;&lt;P&gt;LOAD * RESIDENT NoSuchTable;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Aug 2017 09:42:55 GMT</pubDate>
    <dc:creator>Gysbert_Wassenaar</dc:creator>
    <dc:date>2017-08-09T09:42:55Z</dc:date>
    <item>
      <title>Force script to fail based on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372402#M820246</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have some dashboards and reports that are refreshed periodically by gathering data from aggregation tables in a PostgreSQL database. If the PostgreSQL aggregation jobs fail for some reason, the content in the qvws will be incomplete and, thus, I don't want the dashboards and reports to be reloaded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The way I used to solve this issue was getting information from the database that allows me to know if the jobs ran ok or not. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I created a simple script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;check_tmp:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;select case when ok='TRUE' THEN 1 ELSE 0 end as case from aggregation_job_table;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;check:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;if (case &amp;lt;&amp;gt;1,'notok','ok') as case_2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;resident check_tmp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;store check into check.qvd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I would only need a condition that forces the script to fail:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF case_2 ='ok' then&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;else&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;//go to error;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;end if&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have searched in the community, and it is not quite clear how can I do that: if I write something with a synthax error, the script will fail always, even when I don't want it to. On the other hand, using exit script will not produce an error, so I can't rely on that to get a failed task that I can use as a condition to disable sequential reload tasks in the QMC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess the solution may be very simple, but I am running out of ideas. Can you please suggest something that will get me an error only if case_2 &amp;lt;&amp;gt;'ok'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;João Duarte&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372402#M820246</guid>
      <dc:creator>jduarte12</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Force script to fail based on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372403#M820247</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to make the script fail the do something like loading data from a non-existent table:&lt;/P&gt;&lt;P&gt;LOAD * RESIDENT NoSuchTable;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Aug 2017 09:42:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372403#M820247</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2017-08-09T09:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Force script to fail based on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372404#M820248</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Gysbert.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the script runs normally and raises no error by using this load in the error condition.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Aug 2017 09:55:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372404#M820248</guid>
      <dc:creator>jduarte12</dc:creator>
      <dc:date>2017-08-09T09:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Force script to fail based on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372405#M820249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's not possible unless you disabled error handling by setting ErrorMode to 0. Or if your script never encounters the condition where you want the script to fail on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:05:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372405#M820249</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2017-08-09T10:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Force script to fail based on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372406#M820250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have not disabled error handling.&lt;/P&gt;&lt;P&gt;So the script doesn't encounter the condition, but that's a bit odd: since I know case_2 is 'ok', I am testing the script with a twist in order to test forced failure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;IF case_2 &amp;lt;&amp;gt;'ok' then;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;else&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;LOAD * RESIDENT NoSuchTable;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;end if&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Since case_2='ok', it should try to perform the load and get an error...&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:21:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372406#M820250</guid>
      <dc:creator>jduarte12</dc:creator>
      <dc:date>2017-08-09T10:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: Force script to fail based on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372407#M820252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An if statement like you're using has no knowledge of which tables exist and which fields they contain and which record it should get the value from. So the if statement can't resolve &lt;SPAN style="font-size: 13.3333px;"&gt;case_2 to a value it can use. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Try this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;check_tmp:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;select case when ok='TRUE' THEN 1 ELSE 0 end as case from aggregation_job_table;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;check:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;if (case &amp;lt;&amp;gt;1,'notok','ok') as case_2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;resident check_tmp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;store check into check.qvd;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;LET vCase_2 = peek('case_2',0,'check');&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;If &lt;STRONG&gt;'$(&lt;SPAN style="color: #3d3d3d; font-family: 'courier new', courier; font-size: 12px;"&gt;vCase_2&lt;/SPAN&gt;)'&lt;/STRONG&gt; &amp;lt;&amp;gt; 'ok' Then&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0px 0px 0px 30px; font-size: 12px; color: #3d3d3d;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOAD * RESIDENT NoSuchTable;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;End if&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding: 0 0 0 30px; font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:30:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372407#M820252</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2017-08-09T10:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Force script to fail based on condition</title>
      <link>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372408#M820255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Gysbert. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was not aware of that. It was very helpful. Now it works fine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:37:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Force-script-to-fail-based-on-condition/m-p/1372408#M820255</guid>
      <dc:creator>jduarte12</dc:creator>
      <dc:date>2017-08-09T10:37:09Z</dc:date>
    </item>
  </channel>
</rss>

