<?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 Multiple If statement in Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578470#M597326</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I&amp;nbsp; wrote many If statement in a script . Then, I would like to sum the value of&amp;nbsp; all my "else" statements.&lt;/P&gt;&lt;P&gt;But I don't know how I can recuperate in an unique variable the sum total of the values of my "else" statement.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please could you help me to find a way to make the sum of all the "else" statement.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Below, the beginning of my script:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="script_if.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/11763i5FB197259A5FC768/image-size/large?v=v2&amp;amp;px=999" role="button" title="script_if.PNG" alt="script_if.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:37:44 GMT</pubDate>
    <dc:creator>Black_Hole</dc:creator>
    <dc:date>2024-11-16T03:37:44Z</dc:date>
    <item>
      <title>Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578470#M597326</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I&amp;nbsp; wrote many If statement in a script . Then, I would like to sum the value of&amp;nbsp; all my "else" statements.&lt;/P&gt;&lt;P&gt;But I don't know how I can recuperate in an unique variable the sum total of the values of my "else" statement.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please could you help me to find a way to make the sum of all the "else" statement.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Below, the beginning of my script:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="script_if.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/11763i5FB197259A5FC768/image-size/large?v=v2&amp;amp;px=999" role="button" title="script_if.PNG" alt="script_if.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:37:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578470#M597326</guid>
      <dc:creator>Black_Hole</dc:creator>
      <dc:date>2024-11-16T03:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578577#M597327</link>
      <description>&lt;P&gt;The script seems odd in that either you have the IF statement wrong or you are missing the AS part of the statement.&lt;/P&gt;&lt;P&gt;What I mean is:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;IF(LEFT(CTRY,2)='AT' AND LEN(VAT)=11 AND MID(VAT,3,1)="U" AND ISNUM(RIGHT(VAT,8)),0,1) AS AUSTRIA_VALUE&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;IF(LEFT(CTRY,2)='BE' AND LEN(VAT)=11 AND MID(VAT,3,1)="U" AND ISNUM(RIGHT(VAT,8)),0,1) AS BELGIUM_VALUE&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Or you should have one nested IF...THEN...ELSE statement such as:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;IF(LEFT(CTRY,2)='AT' AND LEN(VAT)=11 AND MID(VAT,3,1)="U" AND ISNUM(RIGHT(VAT,8)),0,&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;&amp;nbsp; &amp;nbsp;IF(LEFT(CTRY,2)='BE' AND LEN(VAT)=11 AND MID(VAT,3,1)="U" AND ISNUM(RIGHT(VAT,8)),0,1)) AS CTRY_VAT_VALUE&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Now, if you are really trying to do the first example then you can do a preceding load on that load as follows:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;LOAD&amp;nbsp; &amp;nbsp; *&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;, IF(AUSTRIA_VALUE=0 AND BELGIUM_VALUE=0,1,0) AS ALL_ZEROS;&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;LOAD CTRY,&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;VAT,&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;IF(LEFT(CTRY,2)='AT' AND LEN(VAT)=11 AND MID(VAT,3,1)="U" AND ISNUM(RIGHT(VAT,8)),0,1) AS AUSTRIA_VALUE,&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;IF(LEFT(CTRY,2)='BE' AND LEN(VAT)=11 AND MID(VAT,3,1)="U" AND ISNUM(RIGHT(VAT,8)),0,1) AS BELGIUM_VALUE&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;FROM........&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4" color="#000000"&gt;If you are trying to do the nested if....then....else then of course your final value in the statement is the final else.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;IF(a=1 and b=2 and c=3,0,&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;&amp;nbsp; if(a=2 and b=3 and c=4,0,&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;if(g=6 and f=4 and h=9,0,&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#000080"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1))) AS Some_Value&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 15:24:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578577#M597327</guid>
      <dc:creator>NW1965</dc:creator>
      <dc:date>2019-05-09T15:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578594#M597328</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/63261"&gt;@NW1965&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you for your answer.&lt;/P&gt;&lt;P&gt;If I understand well what you said in your reply: It's necessary to name each if statement in a first table.&lt;/P&gt;&lt;P&gt;So, in this way, I could in another table call the if statement and realize the sum.&lt;/P&gt;&lt;P&gt;My purpose is to count for each country the sum where value equal to 1 in the if statement.&lt;/P&gt;&lt;P&gt;Below the modification realized considering your advice:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="script_if.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/11784iEC8294E9B7A92E6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="script_if.PNG" alt="script_if.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the first table, I realized all my if statements.&lt;/P&gt;&lt;P&gt;Then, in a second table, I tried to count&amp;nbsp;the if equal to "1" but when I run my script the load of this table failed.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please could you help me to count the if equal to "1"&amp;nbsp; in the second&amp;nbsp;table thanks to the variables in the 1st table.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I hope that my explanation are clear...&lt;/P&gt;&lt;P&gt;Thank you in advance for your support.&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 16:14:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578594#M597328</guid>
      <dc:creator>Black_Hole</dc:creator>
      <dc:date>2019-05-09T16:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578643#M597329</link>
      <description>OK, that won't work because you can't do a sum without grouping in a load statement, you should remember that you are loading one row at a time. Perhaps what you need to do is explain what you want to achieve rather than trying to explain part of the solution and part of the requirement. Questions: 1. In the VAT_REGEX table you are going to create rows of data where you will have a field called AT_VAT and another field called BE_VAT, those fields will contain a 0 or a 1, what is the business purpose or meaning of those fields 2. In the VAT_CHECK table you are creating one more field, this one called TOTAL (I'd recommend renaming that as TOTAL is also a keyword in QlikView), bearing in mind that this is a transactional table with only one country defined per row, this field will only ever hold a value of 1 or 0, so I'd be interested to know the purpose of this too 3. If this really is what you want then the TOTAL field should actually just be defined as IF(AT_VAT=1 OR BE_VAT=1,1) AS TOTAL (i.e. remove the SUM from this) 4. Also be aware the if you already have CUSTOMER_TEST as a table then you have VAT_REGEX and then VAT_CHECK and all of these tables have COUNTRY and VAT_REGIST fields, you're going to end up with a circular reference Hope this helps</description>
      <pubDate>Thu, 09 May 2019 17:27:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578643#M597329</guid>
      <dc:creator>NW1965</dc:creator>
      <dc:date>2019-05-09T17:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578648#M597330</link>
      <description>Looking at this again, are you simply trying to find on a line by line basis if the VAT Registration number is formatted correctly? And on the other side, you want to know how many rows of data you have in the table where the VAT number is formatted incorrectly? Is this correct?</description>
      <pubDate>Thu, 09 May 2019 17:43:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578648#M597330</guid>
      <dc:creator>NW1965</dc:creator>
      <dc:date>2019-05-09T17:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578674#M597331</link>
      <description>&lt;P&gt;Re&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/63261"&gt;@NW1965&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;Looking at this again, are you simply trying to find on a line by line basis if the VAT Registration number is formatted correctly? And on the other side, you want to know how many rows of data you have in the table where the VAT number is formatted incorrectly? Is this correct?"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Yes, it's&amp;nbsp;&lt;/SPAN&gt;exactly the purpose of my script!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;So, do you think that it's wrong to take this problem in two steps:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1/ First table: Define all my statement with the structure of the VAT&lt;/P&gt;&lt;P&gt;2/ Second table: Count the number of rows which are not conform to the structure defined in the first step.&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&lt;/P&gt;&lt;DIV class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-panel lia-panel-standard MessageTagsTaplet Chrome lia-component-message-view-widget-tags"&gt;&lt;DIV class="lia-decoration-border"&gt;&lt;DIV class="lia-decoration-border-top"&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-decoration-border-content"&gt;&lt;DIV&gt;&lt;DIV class="lia-panel-content-wrapper"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 19:01:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578674#M597331</guid>
      <dc:creator>Black_Hole</dc:creator>
      <dc:date>2019-05-09T19:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578815#M597332</link>
      <description>&lt;P&gt;Please any advice to resolve my problem.&lt;/P&gt;&lt;P&gt;Thank you in advance for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 08:37:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578815#M597332</guid>
      <dc:creator>Black_Hole</dc:creator>
      <dc:date>2019-05-10T08:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578847#M597333</link>
      <description>&lt;P&gt;I thought I had replied to this one, now I'm wondering where I posted the reply, the other person is probably now very confused about my response which bears no relation to their question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Anyway, I'd do this in a single statement first, but then split it out in a preceding load to make the expressions easier:&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;,IF(VAT_CHECK='OK',1) AS VATOK&lt;/P&gt;&lt;P&gt;,IF(VAT_CHECK='NO',1) AS VATNOTOK;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOAD CTRY&lt;/P&gt;&lt;P&gt;,VAT&lt;/P&gt;&lt;P&gt;,IF(CTRY='AT' AND LEN(VAT)=11 AND ISNUM(RIGHT(VAT,8))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; OR CTRY='BE' AND LEN(VAT)=12 AND ISNUM(RIGHT(VAT,5))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR CTRY='UK' AND LEN(VAT)=10 AND ISNUM(RIGHT(VAT,4))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , 'OK'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , 'NO' ) AS VAT_CHECK&lt;/P&gt;&lt;P&gt;FROM.......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can use an expression such as SUM(VATOK) and/or SUM(VATNOTOK).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Clear??&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 09:14:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578847#M597333</guid>
      <dc:creator>NW1965</dc:creator>
      <dc:date>2019-05-10T09:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple If statement in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578894#M597334</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/63261"&gt;@NW1965&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Yes, it's more clear ^^&lt;/P&gt;&lt;P&gt;Thank you very much for your precious help !&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 10:55:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Multiple-If-statement-in-Script/m-p/1578894#M597334</guid>
      <dc:creator>Black_Hole</dc:creator>
      <dc:date>2019-05-10T10:55:07Z</dc:date>
    </item>
  </channel>
</rss>

