<?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: Add new column and fill conditionally in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Add-new-column-and-fill-conditionally/m-p/1695935#M725451</link>
    <description>&lt;P&gt;One solution is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Set vCONDITION1 = 'String1','String2','String3';

Set vCONDITION2 = "'String4','String5','String6'";

tab1:
LOAD *, If(Match(Col1,$(vCONDITION1)),'Cond1',
			If(Match(Col1,$(vCONDITION2)),'Cond2',
				'N/A'
			)
		) As Col5
		;
Load 'String'&amp;amp;Round(Rand()*10) As Col1,
	 Pick(Ceil(3*Rand()),'X','Y','Z') as Col2,
 	 Round(1000*Rand()*Rand()) as Col3,
 	 Round(  10*Rand()*Rand()) as Col4
AutoGenerate 10;&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commQV11.PNG" style="width: 266px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/32322i9CD546C9DD481423/image-size/large?v=v2&amp;amp;px=999" role="button" title="commQV11.PNG" alt="commQV11.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Apr 2020 22:14:03 GMT</pubDate>
    <dc:creator>Saravanan_Desingh</dc:creator>
    <dc:date>2020-04-22T22:14:03Z</dc:date>
    <item>
      <title>Add new column and fill conditionally</title>
      <link>https://community.qlik.com/t5/QlikView/Add-new-column-and-fill-conditionally/m-p/1695800#M725450</link>
      <description>&lt;P&gt;I have the following code to load all of my files into qlikview:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data:&lt;/P&gt;&lt;P&gt;// Dummy load so we can use concatenate below&lt;/P&gt;&lt;P&gt;LOAD 0 as dummy AutoGenerate 0;&lt;/P&gt;&lt;P&gt;Concatenate (Data)&lt;/P&gt;&lt;P&gt;LOAD&lt;BR /&gt;Col1,&lt;BR /&gt;Col2,&lt;BR /&gt;Col3,&lt;BR /&gt;Col4&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;[foo\*.xlsx]&lt;/P&gt;&lt;P&gt;(ooxml, embedded labels)&lt;BR /&gt;;DROP FIELD dummy; // Drop dummy field&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now i want to add a new column at the end but it is conditionally on a previous column.&lt;/P&gt;&lt;P&gt;Pseudocode would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Define_Array $CONDITION1 = 'String1','String2','String3'&lt;/P&gt;&lt;P&gt;Define_Array $CONDITION2 = 'String4','String5','String6'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Add Col5 to data //Add an empty column&lt;/P&gt;&lt;P&gt;If Col3 =&amp;nbsp;$CONDITION1 then //So if Col3 is any of the string from the array&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Col5 = 'Cond1'&lt;/P&gt;&lt;P&gt;ElseIf Col3 =&amp;nbsp;$CONDITION2 then //So if Col3 is any of the string from the array&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Col5 = 'Cond2'&lt;/P&gt;&lt;P&gt;Else&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Col5 = 'N/A'&lt;/P&gt;&lt;P&gt;EndIf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So that in the end i have all my data from my excel files but added one new column at the end&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 00:47:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-new-column-and-fill-conditionally/m-p/1695800#M725450</guid>
      <dc:creator>MikeJohn</dc:creator>
      <dc:date>2024-11-16T00:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Add new column and fill conditionally</title>
      <link>https://community.qlik.com/t5/QlikView/Add-new-column-and-fill-conditionally/m-p/1695935#M725451</link>
      <description>&lt;P&gt;One solution is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Set vCONDITION1 = 'String1','String2','String3';

Set vCONDITION2 = "'String4','String5','String6'";

tab1:
LOAD *, If(Match(Col1,$(vCONDITION1)),'Cond1',
			If(Match(Col1,$(vCONDITION2)),'Cond2',
				'N/A'
			)
		) As Col5
		;
Load 'String'&amp;amp;Round(Rand()*10) As Col1,
	 Pick(Ceil(3*Rand()),'X','Y','Z') as Col2,
 	 Round(1000*Rand()*Rand()) as Col3,
 	 Round(  10*Rand()*Rand()) as Col4
AutoGenerate 10;&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commQV11.PNG" style="width: 266px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/32322i9CD546C9DD481423/image-size/large?v=v2&amp;amp;px=999" role="button" title="commQV11.PNG" alt="commQV11.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 22:14:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Add-new-column-and-fill-conditionally/m-p/1695935#M725451</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2020-04-22T22:14:03Z</dc:date>
    </item>
  </channel>
</rss>

