<?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: [Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax? in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2129156#M91835</link>
    <description>&lt;P&gt;Thanks but this is as far from "readable" as it gets. Not useable.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Oct 2023 10:39:16 GMT</pubDate>
    <dc:creator>Golem</dc:creator>
    <dc:date>2023-10-17T10:39:16Z</dc:date>
    <item>
      <title>[Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax?</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2117334#M91154</link>
      <description>&lt;P&gt;Since my SQL code contains business logic and private information about sales data I can't share the full code.&lt;/P&gt;
&lt;P&gt;Here are some example lines:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CASE
    WHEN PRODUCTNAME  LIKE '%hand used vaccum cleaner%'
     AND PRODUCTGROUP = 'Vacuum'
        THEN 'Cleaning and Household'
    WHEN PRODUCTGROUP IN ('Smartwatch', 'Toshiba', 'Healthcare', 'Toothbrush', 'Bodycare', 'Tanner', 'Hair Drier')
        THEN 'Comfort'
    WHEN PRODUCT_LEVEL_10 IS NOT NULL
        THEN PRODUCT_LEVEL_10
        ELSE 'ERROR'
END
    AS PRODUCTLEVEL_A&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The full statement has 20+ WHEN checks in this format.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;How can I rewrite that in modern readable, debuggable Qlik syntax?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 09:57:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2117334#M91154</guid>
      <dc:creator>Golem</dc:creator>
      <dc:date>2024-01-30T09:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: [Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax?</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2117368#M91157</link>
      <description>&lt;P&gt;There are several ways to do that. I suspect your code is just an example, so here is a solution that should hint you in couple other ways you can solve it too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Coalese(
Pick(
	Wildmatch(
		[PRODUCTNAME]&amp;amp;'-'&amp;amp;[PRODUCTGROUP], 
		'*hand used vaccum cleaner*-Vacuum', 
		'Smartwatch-*', 
		'Toshiba-*', 
		'Healthcare-*', 
		'Toothbrush-*', 
		'Bodycare-*', 
		'Tanner-*', 
		'Hair Drier-*'
		),
'Cleaning and Household',
'Comfort',
'Comfort',
'Comfort',
'Comfort',
'Comfort',
'Comfort',
'Comfort'), PRODUCT_LEVEL_10, 'ERROR')			AS PRODUCTLEVEL_A&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 12:02:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2117368#M91157</guid>
      <dc:creator>Stoyan_Terziev</dc:creator>
      <dc:date>2023-09-15T12:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: [Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax?</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2129156#M91835</link>
      <description>&lt;P&gt;Thanks but this is as far from "readable" as it gets. Not useable.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 10:39:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2129156#M91835</guid>
      <dc:creator>Golem</dc:creator>
      <dc:date>2023-10-17T10:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: [Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax?</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2129157#M91836</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/123227"&gt;@Golem&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried with Ifs?&lt;/P&gt;
&lt;P&gt;If(PRODUCTNAME LIKE '*hand used vaccum cleaner*' AND PRODUCTGROUP = 'Vacuum','Cleaning and Household',&lt;BR /&gt;If(Match(PRODUCTGROUP,'Smartwatch', 'Toshiba', 'Healthcare', 'Toothbrush', 'Bodycare', 'Tanner', 'Hair Drier') &amp;gt; 0, 'Comfort',&lt;BR /&gt;If(IsNull(PRODUCT_LEVEL_10) = 0, PRODUCT_LEVEL_10,'ERROR')&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;Instead of LIKE you can use the following functions: Match() or WildMatch().&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 10:48:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2129157#M91836</guid>
      <dc:creator>LDR</dc:creator>
      <dc:date>2023-10-17T10:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: [Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax?</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2129160#M91837</link>
      <description>&lt;P&gt;Thanks but nested ifs are not readable or maintainable.&lt;/P&gt;
&lt;P&gt;I would expect something like pattern matching in this century but yeah, Qlik is from the 90s it seems.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 10:51:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2129160#M91837</guid>
      <dc:creator>Golem</dc:creator>
      <dc:date>2023-10-17T10:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: [Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax?</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2138051#M92496</link>
      <description>&lt;P&gt;If you look closely, I used pattern matching. The special character that Qlik uses is asterisk (*).&lt;BR /&gt;&lt;BR /&gt;If you want to create a mapping function and a configurable table with values and their mapping pattern you can do that but the principle remains the same as I showed in the example.&lt;/P&gt;
&lt;P&gt;Neither PBI nor Tableau has what you are looking for out of the box.&lt;/P&gt;
&lt;P&gt;I'm interested for how you solved the problem in a more Readable and Useable way.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 13:49:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2138051#M92496</guid>
      <dc:creator>Stoyan_Terziev</dc:creator>
      <dc:date>2023-11-15T13:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: [Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax?</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2138100#M92501</link>
      <description>&lt;P&gt;I suggest you develop a more readable and maintainable solution in SQL as the used case-approach and then come back and we adapt it within Qlik.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 15:07:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2138100#M92501</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-11-15T15:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: [Qlik Cloud] How to rewrite SQL CASE WHEN into Qlik syntax?</title>
      <link>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2412433#M94736</link>
      <description>&lt;P&gt;The SQL code I posted was not my code but from my predecessor but you are right it's a total mess in terms of readability and maintainability.&lt;BR /&gt;Has to be replaced with Qlik syntax anyway due to manager reasons and it's a big chunk of code so I didn't bother with reformatting when it gets replaced anyway.&lt;BR /&gt;&lt;BR /&gt;Reformatted it now.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2024 09:59:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Qlik-Cloud-How-to-rewrite-SQL-CASE-WHEN-into-Qlik-syntax/m-p/2412433#M94736</guid>
      <dc:creator>Golem</dc:creator>
      <dc:date>2024-01-30T09:59:51Z</dc:date>
    </item>
  </channel>
</rss>

