<?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: If condition in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982434#M81076</link>
    <description>Sorry I don't have any, actually I'm still in learning stage&lt;BR /&gt;&lt;BR /&gt;if you could please provide the solution for my query, it would be great.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
    <pubDate>Mon, 19 Sep 2022 09:42:21 GMT</pubDate>
    <dc:creator>Bharathi09</dc:creator>
    <dc:date>2022-09-19T09:42:21Z</dc:date>
    <item>
      <title>If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982380#M81069</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have two columns in my dataset 'Code' and 'Parts'&lt;/P&gt;
&lt;P&gt;I have to create Country column in the backend scripting by writing below logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if any of the code = 34 or 35 country = Canada&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if&amp;nbsp;any of the code&amp;nbsp;=14, 20 OR 43&amp;nbsp;country = Mexico&lt;/P&gt;
&lt;P&gt;if&amp;nbsp;any of the&amp;nbsp; code =&amp;nbsp;34 or 35 and&amp;nbsp;14, 20 OR 43&amp;nbsp;country = Both&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me with this&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 08:27:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982380#M81069</guid>
      <dc:creator>Bharathi09</dc:creator>
      <dc:date>2022-09-19T08:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982394#M81073</link>
      <description>&lt;P&gt;Hi, if by "&lt;SPAN&gt;if any of the code = 34 or 35 country = Canada&lt;/SPAN&gt;" you meant that code = 34 or parts = 35, then something like this should do the trick:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;[ml_all_countries]:
MAPPING LOAD
CODE &amp;amp; '|' &amp;amp; PARTS,
'Both' as COUNTRY
INLINE [
CODE,PARTS
34,20
34,43
35,20
35,43
14,20
14,43
];

[ml_can_code]:
MAPPING LOAD
CODE,
'Canada' as COUNTRY
INLINE [
CODE,COUNTRY
34
];

[ml_can_parts]:
MAPPING LOAD
PARTS,
'Canada' as COUNTRY
INLINE [
PARTS,COUNTRY
35
];

[ml_mex_code]:
MAPPING LOAD
CODE,
'Mexico' as COUNTRY
INLINE [
CODE,COUNTRY
14
20
];

[ml_mex_parts]:
MAPPING LOAD
PARTS,
'Mexico' as COUNTRY
INLINE [
PARTS,COUNTRY
43
];


data:
LOAD *,
ROWNO() AS row,
APPLYMAP('ml_all_countries',CODE &amp;amp; '|' &amp;amp; PARTS,
APPLYMAP('ml_can_code',CODE,
APPLYMAP('ml_can_parts',PARTS,
APPLYMAP('ml_mex_code',CODE,
APPLYMAP('ml_mex_parts',PARTS,'Not defined'))))) as COUNTRY
INLINE [
CODE,PARTS
34,20
34,43
35,20
35,43
14,20
14,43
34,100
35,100
35,35
14,100
100,43
20,100
];&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Sep 2022 08:41:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982394#M81073</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2022-09-19T08:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982399#M81074</link>
      <description>I have code column in excel as below&lt;BR /&gt;[cid:100e706f-fa4d-4fab-bcc7-46afa0060c57]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I mean to tell if code=&lt;BR /&gt;if any of the  code = 34 or 35 country = Canada&lt;BR /&gt;if any of the  code =14, 20 OR 43 country = Mexico&lt;BR /&gt;if any of the  code = 34 or 35 and 14, 20 OR 43 country = Both&lt;BR /&gt;&lt;BR /&gt;I need to create as new Country column in backend for above requirement&lt;BR /&gt;&lt;BR /&gt;Please help&lt;BR /&gt;&lt;BR /&gt;Thanks in advance&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Sep 2022 08:49:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982399#M81074</guid>
      <dc:creator>Bharathi09</dc:creator>
      <dc:date>2022-09-19T08:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982407#M81075</link>
      <description>&lt;P&gt;If you could provide a few codes with desired results, that'd be great.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 08:55:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982407#M81075</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2022-09-19T08:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982434#M81076</link>
      <description>Sorry I don't have any, actually I'm still in learning stage&lt;BR /&gt;&lt;BR /&gt;if you could please provide the solution for my query, it would be great.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Sep 2022 09:42:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982434#M81076</guid>
      <dc:creator>Bharathi09</dc:creator>
      <dc:date>2022-09-19T09:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982450#M81078</link>
      <description>&lt;P&gt;You wrote, that you have a column in excel with codes like these:&lt;BR /&gt;&lt;SPAN&gt;[cid:100e706f-fa4d-4fab-bcc7-46afa0060c57]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;If you could provide more codes like these with countries that should be calculated for them in a form like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;Code&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;Country&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;&lt;SPAN&gt;[cid:100e706f-fa4d-4fab-bcc7-46afa0060c57]&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;???&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;&lt;SPAN&gt;[cid:200a556m-ab4e-4fab-bcc7-34atg1234s51]&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;???&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="50%" height="25px"&gt;...&lt;/TD&gt;
&lt;TD width="50%" height="25px"&gt;???&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 19 Sep 2022 10:09:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982450#M81078</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2022-09-19T10:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982458#M81079</link>
      <description>&lt;P&gt;Code means column name code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bharathi09_0-1663582290474.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89328iC10CBD56BB010FA4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bharathi09_0-1663582290474.png" alt="Bharathi09_0-1663582290474.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;This is my excel and the from this I need to create country column in scripting by using below logic&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if code =34 or 35 country = Canada&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if&amp;nbsp; code =14, 20 OR 43 country = Mexico&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if&amp;nbsp; code = 34 or 35 and 14, 20 OR 43 country = Both&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please help&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 10:14:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982458#M81079</guid>
      <dc:creator>Bharathi09</dc:creator>
      <dc:date>2022-09-19T10:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982475#M81081</link>
      <description>&lt;P&gt;Based on your excel file, should the result look like this?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RsQK_0-1663583588512.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/89330i1108F88489C524B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RsQK_0-1663583588512.png" alt="RsQK_0-1663583588512.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 10:33:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982475#M81081</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2022-09-19T10:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982511#M81084</link>
      <description>can you please send me the code you have written?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Sep 2022 11:46:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982511#M81084</guid>
      <dc:creator>Bharathi09</dc:creator>
      <dc:date>2022-09-19T11:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982539#M81087</link>
      <description>&lt;P&gt;Sure:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;SET p_can_codes = 34,35;
SET p_mex_codes = 14,20,43;

temp_data:
LOAD *,
ROWNO() AS Row
INLINE [
Part,Code
1,34
2,35
3,14
4,20
5,43
6,34
7,35
8,14
9,20
10,43
1,14
2,20
3,34
4,35
5,14
6,43
];

//Canada:
temp_can:
LOAD DISTINCT
Part,
Code	AS Can_code
RESIDENT temp_data;

INNER JOIN (temp_can)
LOAD
SUBFIELD('$(p_can_codes)',',') AS Can_code
AUTOGENERATE 1;

temp_can2:
LOAD DISTINCT
Part
RESIDENT temp_can;

DROP TABLE temp_can;

LEFT JOIN (temp_data)
LOAD
Part,
1	AS can_flag
RESIDENT temp_can2;

DROP TABLE temp_can2;

//Mexico:
temp_mex:
LOAD DISTINCT
Part,
Code	AS Mex_code
RESIDENT temp_data;

INNER JOIN (temp_mex)
LOAD
SUBFIELD('$(p_mex_codes)',',') AS Mex_code
AUTOGENERATE 1;

temp_mex2:
LOAD DISTINCT
Part
RESIDENT temp_mex;

DROP TABLE temp_mex;

LEFT JOIN (temp_data)
LOAD
Part,
1	AS mex_flag
RESIDENT temp_mex2;

DROP TABLE temp_mex2;

data:
LOAD *,
PICK(MATCH(comb_flag,'1|1','|1','1|'),'Both','Mexico','Canada') AS Country
;
LOAD *,
can_flag &amp;amp; '|' &amp;amp; mex_flag as comb_flag
RESIDENT temp_data;

DROP TABLE temp_data;

DROP FIELDS can_flag,mex_flag,comb_flag;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Sep 2022 12:22:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982539#M81087</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2022-09-19T12:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982543#M81088</link>
      <description>I already loaded data , inline is not required, I loaded part and code fields in application&lt;BR /&gt;&lt;BR /&gt;can you send code with normal load&lt;BR /&gt;&lt;BR /&gt;Thanks alot&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Sep 2022 12:31:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982543#M81088</guid>
      <dc:creator>Bharathi09</dc:creator>
      <dc:date>2022-09-19T12:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982551#M81090</link>
      <description>&lt;P&gt;Since I dont know your data connection name, file name or sheet name, you will have to adjust the FROM part. Just change the "YOUR_CONNECTION_NAME", "YOUR_FILE_NAME", "YOUR_SHEET_NAME" accordingly.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SET p_can_codes = 34,35;
SET p_mex_codes = 14,20,43;

temp_data:
LOAD 
Part,
Code
FROM [lib://YOUR_CONNECTION_NAME/YOUR_FILE_NAME.xlsx]
(ooxml, embedded labels, table is 'YOUR_SHEET_NAME');

//Canada:
temp_can:
LOAD DISTINCT
Part,
Code	AS Can_code
RESIDENT temp_data;

INNER JOIN (temp_can)
LOAD
SUBFIELD('$(p_can_codes)',',') AS Can_code
AUTOGENERATE 1;

temp_can2:
LOAD DISTINCT
Part
RESIDENT temp_can;

DROP TABLE temp_can;

LEFT JOIN (temp_data)
LOAD
Part,
1	AS can_flag
RESIDENT temp_can2;

DROP TABLE temp_can2;

//Mexico:
temp_mex:
LOAD DISTINCT
Part,
Code	AS Mex_code
RESIDENT temp_data;

INNER JOIN (temp_mex)
LOAD
SUBFIELD('$(p_mex_codes)',',') AS Mex_code
AUTOGENERATE 1;

temp_mex2:
LOAD DISTINCT
Part
RESIDENT temp_mex;

DROP TABLE temp_mex;

LEFT JOIN (temp_data)
LOAD
Part,
1	AS mex_flag
RESIDENT temp_mex2;

DROP TABLE temp_mex2;

data:
LOAD *,
PICK(MATCH(comb_flag,'1|1','|1','1|'),'Both','Mexico','Canada') AS Country
;
LOAD *,
can_flag &amp;amp; '|' &amp;amp; mex_flag as comb_flag
RESIDENT temp_data;

DROP TABLE temp_data;

DROP FIELDS can_flag,mex_flag,comb_flag;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 12:41:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982551#M81090</guid>
      <dc:creator>RsQK</dc:creator>
      <dc:date>2022-09-19T12:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: If condition</title>
      <link>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982565#M81091</link>
      <description>Thanks alot&lt;BR /&gt;This helped me&lt;BR /&gt;But can we minimize the code?&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Sep 2022 12:57:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/If-condition/m-p/1982565#M81091</guid>
      <dc:creator>Bharathi09</dc:creator>
      <dc:date>2022-09-19T12:57:21Z</dc:date>
    </item>
  </channel>
</rss>

