<?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: Looping in a field in Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Looping-in-a-field-in-Script/m-p/103011#M16313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Rehan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;LET&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vDWDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;null&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;();&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;LET&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vToday&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;num&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;today&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;());&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Set&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vCounter&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = 1;&lt;BR /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// Start loop script that will continue until condition is met.&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Do&lt;/STRONG&gt; &lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;until&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vDWDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vToday&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; Trigger:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Select&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; DISTINCT DATE_TIME as DWDate&lt;BR /&gt; FROM AUDIT_DATA&lt;BR /&gt; where DATE_TIME = (Select max(DATE_TIME) FROMFROM AUDIT_DATA);&lt;BR /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;LET&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vDWDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;('DWDate');&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// where condition is met, exit and complete.&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;if&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vDWDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vToday&lt;/SPAN&gt; &lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Exit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Do&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// where condition is not met, drop that table ready to restart the load process.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;elseif&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vCounter&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; =5 &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;then&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;TRACE&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; 'Date does not exist!!';&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Manual error message that will be captured in log&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;SET&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;TriggerError&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//This line of code triggers an error&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Exit&lt;/STRONG&gt; &lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Do&lt;/STRONG&gt;&amp;nbsp; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//or exit script;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Else&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;DROP&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;TABLE&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; Trigger;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//The sleep means that we can control the frequency of calls to the source database (or file).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Sleep&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; 5000;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// 10000 milliseconds = 10 seconds.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Let&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vCounter&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vCounter&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; +1;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Increasing counter on each load&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;ENDIF&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// where condition is not met then restart loop.&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;loop&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;exit&lt;/STRONG&gt; &lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;script&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jul 2018 02:44:29 GMT</pubDate>
    <dc:creator>tamilarasu</dc:creator>
    <dc:date>2018-07-03T02:44:29Z</dc:date>
    <item>
      <title>Looping in a field in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Looping-in-a-field-in-Script/m-p/103010#M16312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have created a&amp;nbsp; QVW which checks for today's date in an Audit table from Database.&amp;nbsp; If Today's Date exits in the table then it suppose to exit which will trigger the next load to start, but if the date is not today it loops every 5 secs to check for today's date. I would like to add the below 2 things:&lt;/P&gt;&lt;P&gt;1) If the date is not today then check every 5 secs do it 5 times and then exit with a load failure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vDWDate = null();&lt;/P&gt;&lt;P&gt;LET vToday = num(today());&lt;/P&gt;&lt;P&gt;// Start loop script that will continue until condition is met.&lt;/P&gt;&lt;P&gt;Do until vDWDate=vToday &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trigger:&lt;/P&gt;&lt;P&gt;Select&amp;nbsp; DISTINCT DATE_TIME as DWDate&lt;/P&gt;&lt;P&gt;FROM AUDIT_DATA&lt;/P&gt;&lt;P&gt;where DATE_TIME = (Select max(DATE_TIME) FROM&lt;SPAN style="font-size: 13.3333px;"&gt;FROM AUDIT_DATA&lt;/SPAN&gt;) ; &lt;/P&gt;&lt;P&gt;LET vDWDate = peek('DWDate'); &lt;/P&gt;&lt;P&gt;// where condition is met, exit and complete. &lt;/P&gt;&lt;P&gt;if vDWDate=vToday then&lt;/P&gt;&lt;P&gt;&amp;nbsp; Exit Do&lt;/P&gt;&lt;P&gt;// where condition is not met, drop that table ready to restart the load process.&lt;/P&gt;&lt;P&gt;else &lt;/P&gt;&lt;P&gt;DROP TABLE Trigger;&lt;/P&gt;&lt;P&gt;// The sleep means that we can control the frequency of calls to the source database (or file). &lt;/P&gt;&lt;P&gt;Sleep 5000;&amp;nbsp; // 10000 milliseconds = 10 seconds.&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;// where condition is not met then restart loop.&lt;/P&gt;&lt;P&gt;loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;exit script;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Jul 2018 21:35:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looping-in-a-field-in-Script/m-p/103010#M16312</guid>
      <dc:creator>azmeerrehan</dc:creator>
      <dc:date>2018-07-02T21:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Looping in a field in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Looping-in-a-field-in-Script/m-p/103011#M16313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Rehan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;LET&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vDWDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;null&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;();&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;LET&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vToday&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;num&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;today&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;());&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Set&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vCounter&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = 1;&lt;BR /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// Start loop script that will continue until condition is met.&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Do&lt;/STRONG&gt; &lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;until&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vDWDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vToday&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; Trigger:&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Select&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp; DISTINCT DATE_TIME as DWDate&lt;BR /&gt; FROM AUDIT_DATA&lt;BR /&gt; where DATE_TIME = (Select max(DATE_TIME) FROMFROM AUDIT_DATA);&lt;BR /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;LET&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vDWDate&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;peek&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;('DWDate');&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// where condition is met, exit and complete.&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;if&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vDWDate&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vToday&lt;/SPAN&gt; &lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Exit&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Do&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// where condition is not met, drop that table ready to restart the load process.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;elseif&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vCounter&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; =5 &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;then&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;TRACE&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; 'Date does not exist!!';&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Manual error message that will be captured in log&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;SET&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;TriggerError&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//This line of code triggers an error&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Exit&lt;/STRONG&gt; &lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Do&lt;/STRONG&gt;&amp;nbsp; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//or exit script;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Else&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 9.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 9.0pt; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;DROP&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;TABLE&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; Trigger;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//The sleep means that we can control the frequency of calls to the source database (or file).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Sleep&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; 5000;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// 10000 milliseconds = 10 seconds.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;Let&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM style="color: gray; font-size: 9.0pt; font-family: 'Courier New';"&gt;vCounter&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: maroon;"&gt;vCounter&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt; +1;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;//Increasing counter on each load&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue;"&gt;ENDIF&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green;"&gt;// where condition is not met then restart loop.&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;loop&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;exit&lt;/STRONG&gt; &lt;STRONG style="color: blue; font-size: 9.0pt; font-family: 'Courier New';"&gt;script&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black;"&gt;; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jul 2018 02:44:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Looping-in-a-field-in-Script/m-p/103011#M16313</guid>
      <dc:creator>tamilarasu</dc:creator>
      <dc:date>2018-07-03T02:44:29Z</dc:date>
    </item>
  </channel>
</rss>

