<?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 How do you create a case when statement in the QV load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193361#M54660</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help. It worked!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Mar 2010 21:25:47 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-03-29T21:25:47Z</dc:date>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193354#M54653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a field called PRICE that I want to segment out. In SQL i would do the following:&lt;/P&gt;&lt;P&gt;CASE&lt;/P&gt;&lt;P&gt;WHEN PRICE &amp;lt; 10 then '&amp;lt; $10'&lt;/P&gt;&lt;P&gt;WHEN PRICE between 10 and 15 then '$10 - $15'&lt;/P&gt;&lt;P&gt;WHEN PRICE between 15 and 20 then '$15 - $20'&lt;/P&gt;&lt;P&gt;WHEN PRICE between 20 and 25 then '$20 - $25')&lt;/P&gt;&lt;P&gt;ELSE '&amp;gt;$25'&lt;/P&gt;&lt;P&gt;END as [Price Segment]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How would I do this in the LOAD script in qlikview?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 00:33:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193354#M54653</guid>
      <dc:creator />
      <dc:date>2010-03-25T00:33:57Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193355#M54654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your case, you probably have to do it in 5 nested IF statements... Pretty ugly, but I don't think there is anything more elegant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 02:29:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193355#M54654</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2010-03-25T02:29:48Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193356#M54655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could also set up an interval match table to match PRICE against to get the values in the correct brackets.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 04:49:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193356#M54655</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-25T04:49:19Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193357#M54656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Johannes,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not familiar with interval match tables. Can you point me in the right direction to where I can find step by step instructions on how to use this technique?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Mar 2010 16:49:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193357#M54656</guid>
      <dc:creator />
      <dc:date>2010-03-25T16:49:12Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193358#M54657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would seriously just write the nested IF:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(PRICE&amp;lt;10,'&amp;lt; $10'&lt;BR /&gt;,if(PRICE&amp;lt;15,'$10 - $15'&lt;BR /&gt;,if(PRICE&amp;lt;20,'$15 - $20'&lt;BR /&gt;,if(PRICE&amp;lt;25,'$20 - $25'&lt;BR /&gt; ,'&amp;gt; $25')))) as Range&lt;/P&gt;&lt;P&gt;But as far as intervalmatch goes, I think the below is what you want. I wouldn't do this, but you could. Just search for intervalmatch in the help for more information.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;[Ranges]:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;Min,Max,Range&lt;BR /&gt;0,9.99,&amp;lt; $10&lt;BR /&gt;10,14.99,$10 - $15&lt;BR /&gt;15,19.99,$15 - $20&lt;BR /&gt;20,24.99,$20 - $25&lt;BR /&gt;25,,&amp;gt; $25&lt;BR /&gt;];&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;[Main Table]:&lt;BR /&gt;LOAD&lt;BR /&gt;...&lt;BR /&gt;PRICE&lt;BR /&gt;...&lt;BR /&gt;FROM SOME SOURCE&lt;BR /&gt;;&lt;BR /&gt;INTERVALMATCH (PRICE)&lt;BR /&gt;LOAD&lt;BR /&gt; Min&lt;BR /&gt;,Max&lt;BR /&gt;RESIDENT [Ranges]&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;Also worth considering, though the intervals end up the same width and it doesn't display exactly as you like, is this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;class(PRICE,5,'$') as Range&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Mar 2010 00:58:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193358#M54657</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-03-26T00:58:10Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193359#M54658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;Your script is good. thanks, but can you help me with the syntax a bit. How do i include "and" statements in QV?&lt;/P&gt;&lt;P&gt;for example,&lt;/P&gt;&lt;P&gt;IF (Bottle &amp;gt; 0.75 and Bottle not in (1, 3, 16), '&amp;gt; 750mL)&lt;/P&gt;&lt;P&gt;How do i incorporate these types of sql elements into QV syntax?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Mar 2010 21:12:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193359#M54658</guid>
      <dc:creator />
      <dc:date>2010-03-29T21:12:46Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193360#M54659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The match() function takes the role of the SQL IN statement. Like so:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;if(Bottle&amp;gt;0.75 and not match(Bottle,1,3,16), '&amp;gt; 750 mL')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Mar 2010 21:18:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193360#M54659</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-03-29T21:18:44Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193361#M54660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your help. It worked!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Mar 2010 21:25:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193361#M54660</guid>
      <dc:creator />
      <dc:date>2010-03-29T21:25:47Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193362#M54661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a Table of CITY , When I go for match function I had to write some times 4 cities names, some times 6 cities name, what I am facing is I write again and again city names regarding different criterias, Is it possible that I bring a Field in the Match fucntion in which that particular fields contains all the city name and should match them on conditions, as such there would be no need for writng city names again and again. I mean I dont want to write city names in Match function again and again I just need a Field which should fetch city names and go for matching in Match function. For example it takes log if I have to write 25 city names, is there any simple solution that city be fetched in Match function without writing them again and again.&lt;/P&gt;&lt;P&gt;CITY:&lt;/P&gt;&lt;P&gt;London&lt;/P&gt;&lt;P&gt;New York&lt;/P&gt;&lt;P&gt;Maxico&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on all the cities upto 100.&lt;/P&gt;&lt;P&gt;if (Match (City, 'London', 'New York', 'Maxico','Karachi','Mumbai')) as XYZ&lt;/P&gt;&lt;P&gt;in upper case I had to write all the names depending condition.&lt;/P&gt;&lt;P&gt;is it possible like: IF (MATCH(City)) as XYZ.&lt;/P&gt;&lt;P&gt;Khalid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 11:04:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193362#M54661</guid>
      <dc:creator />
      <dc:date>2010-06-17T11:04:32Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193363#M54662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi There,&lt;/P&gt;&lt;P&gt;I have a Table of CITY , When I go for match function I had to write some times 4 cities names, some times 6 cities name, what I am facing is I write again and again city names regarding different criterias, Is it possible that I bring a Field in the Match fucntion in which that particular fields contains all the city name and should match them on conditions, as such there would be no need for writng city names again and again. I mean I dont want to write city names in Match function again and again I just need a Field which should fetch city names and go for matching in Match function. For example it takes log if I have to write 25 city names, is there any simple solution that city be fetched in Match function without writing them again and again.&lt;/P&gt;&lt;P&gt;CITY:&lt;/P&gt;&lt;P&gt;London&lt;/P&gt;&lt;P&gt;New York&lt;/P&gt;&lt;P&gt;Maxico&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and so on all the cities upto 100.&lt;/P&gt;&lt;P&gt;if (Match (City, 'London', 'New York', 'Maxico','Karachi','Mumbai')) as XYZ&lt;/P&gt;&lt;P&gt;in upper case I had to write all the names depending condition.&lt;/P&gt;&lt;P&gt;is it possible like: IF (MATCH(City)) as XYZ.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Khalid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 11:05:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193363#M54662</guid>
      <dc:creator />
      <dc:date>2010-06-17T11:05:33Z</dc:date>
    </item>
    <item>
      <title>How do you create a case when statement in the QV load script</title>
      <link>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193364#M54663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, in the other thread where you posted this, it sounded like someone wanted you to discover the answer for yourself. Here you don't say this, so I'm free to post the five or six solutions I have, depending on how you count them. &lt;IMG alt="Wink" src="http://community.qlik.com/emoticons/emotion-5.gif" /&gt; I suggest using the exists() solution. It seems simplest.&lt;/P&gt;&lt;P&gt;Script solutions:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;[City List]:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;City List&lt;BR /&gt;London&lt;BR /&gt;New York&lt;BR /&gt;Maxico&lt;BR /&gt;];&lt;BR /&gt;[City List 2]:&lt;BR /&gt;MAPPING LOAD&lt;BR /&gt; "City List"&lt;BR /&gt;,'in list' as "In List? 2"&lt;BR /&gt;RESIDENT [City List]&lt;BR /&gt;;&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;SET InCityList = 'if(match($1';&lt;BR /&gt;FOR I = 1 TO noofrows('City List')&lt;BR /&gt; LET InCityList = InCityList &amp;amp; ',' &amp;amp; chr(39) &amp;amp; fieldvalue('City List',$(I)) &amp;amp; chr(39);&lt;BR /&gt;NEXT&lt;BR /&gt;LET InCityList = InCityList &amp;amp; '),' &amp;amp; chr(39) &amp;amp; 'in list' &amp;amp; chr(39) &amp;amp; ',' &amp;amp; chr(39) &amp;amp; 'not in list' &amp;amp; chr(39) &amp;amp; ')';&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;[Data]:&lt;BR /&gt;LOAD&lt;BR /&gt; "City"&lt;BR /&gt;,if(exists("City List","City"),'in list','not in list') as "In List? 1"&lt;BR /&gt;,applymap('City List 2',"City",'not in list') as "In List? 2"&lt;BR /&gt;,$(InCityList("City")) as "In List? 3"&lt;BR /&gt;INLINE [&lt;BR /&gt;City&lt;BR /&gt;London&lt;BR /&gt;New York&lt;BR /&gt;Maxico&lt;BR /&gt;San Franciso&lt;BR /&gt;Venice&lt;BR /&gt;];&lt;BR /&gt;LEFT JOIN ([Data])&lt;BR /&gt;LOAD&lt;BR /&gt; "City List" as "City"&lt;BR /&gt;,'in list' as "In List? 4 Temp"&lt;BR /&gt;RESIDENT [City List]&lt;BR /&gt;;&lt;BR /&gt;LEFT JOIN ([Data])&lt;BR /&gt;LOAD&lt;BR /&gt; "City"&lt;BR /&gt;,if(len("In List? 4 Temp"),"In List? 4 Temp",'not in list') as "In List? 4"&lt;BR /&gt;RESIDENT [Data]&lt;BR /&gt;;&lt;BR /&gt;DROP FIELD "In List? 4 Temp";&lt;/P&gt;&lt;P&gt;Chart solutions:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Expression = $(InCityList("City"))&lt;BR /&gt;Expression = if(match("City",$(=chr(39)&amp;amp;concat("City List",chr(39)&amp;amp;','&amp;amp;chr(39))&amp;amp;chr(39))),'in list','not in list')&lt;/P&gt;&lt;P&gt;Edit: Another chart solution:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Expression = if(count({&amp;lt;"City"=P("City List")&amp;gt;} "City"),'in list','not in list')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jun 2010 18:49:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-do-you-create-a-case-when-statement-in-the-QV-load-script/m-p/193364#M54663</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-06-17T18:49:36Z</dc:date>
    </item>
  </channel>
</rss>

