<?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: Append field into table based on another table in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Append-field-into-table-based-on-another-table/m-p/762341#M1033373</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your conditions involve values from multiple rows (for example, the Item should exist in both divisions, or in either one of the divisions). In order to calculate that, you should first aggregate your data from Contract_Items by Item and concatenate all available divisions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Contract_Items_Sum:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Item,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat(Division, '_') as AllDivisions&lt;/P&gt;&lt;P&gt;resident&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Contract_Items&lt;/P&gt;&lt;P&gt;group by&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Item&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, you can prioritize your conditions from more strict to less strict and calculate the corresponding status. You can test the whole value of AllDivisions or test whether certain Division name is part of the value or not. Use the Index() function or the SubstringCount() function for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;P&gt;www.masterssummit.com - take your QlikView skills to the next level!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Feb 2015 01:12:59 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2015-02-07T01:12:59Z</dc:date>
    <item>
      <title>Append field into table based on another table</title>
      <link>https://community.qlik.com/t5/QlikView/Append-field-into-table-based-on-another-table/m-p/762340#M1033370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have two tables, "&lt;EM&gt;Items&lt;/EM&gt;" and "&lt;EM&gt;Contract_Item&lt;/EM&gt;s".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am taking one field from&lt;EM&gt; Items&lt;/EM&gt; - "Item_Number"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am taking two fields from &lt;EM&gt;Contract_Items&lt;/EM&gt; - "Item_Number' and "Division"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to load everything from &lt;EM&gt;Items&lt;/EM&gt; and append in a field "Contract_Status" that is generated based on conditions from &lt;EM&gt;Contract_Items&lt;/EM&gt;. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example - If Item_Number 12345 in&lt;EM&gt; Items&lt;/EM&gt; exist in &lt;EM style="font-size: 13.3333330154419px;"&gt;Contract_Items &lt;/EM&gt;with "Division" = '300', I have a field "Contract_Status" = 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If 12345 exists in &lt;EM&gt;Contract_Items&lt;/EM&gt; with Division = 300 and 345, "Contract_Status" = 2 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If 12345 does not exist in &lt;EM&gt;Contract_Items&lt;/EM&gt; in either Division 300 or 345, "Contract_Status" = 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this, but it just returned the original Division information:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;IF(Division='300',Dual(Division,1),&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(Division='345', Dual(Division,2),&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(Division&amp;lt;&amp;gt;'300', Dual(Division,3),&lt;/P&gt;&lt;P&gt;&amp;nbsp; IF(Division &amp;lt;&amp;gt;'345', Dual(Division,4))))) as CI_Status,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Contract_Item",&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Division as CI_Division;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Feb 2015 23:01:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Append-field-into-table-based-on-another-table/m-p/762340#M1033370</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-02-06T23:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Append field into table based on another table</title>
      <link>https://community.qlik.com/t5/QlikView/Append-field-into-table-based-on-another-table/m-p/762341#M1033373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your conditions involve values from multiple rows (for example, the Item should exist in both divisions, or in either one of the divisions). In order to calculate that, you should first aggregate your data from Contract_Items by Item and concatenate all available divisions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Contract_Items_Sum:&lt;/P&gt;&lt;P&gt;load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Item,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; concat(Division, '_') as AllDivisions&lt;/P&gt;&lt;P&gt;resident&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Contract_Items&lt;/P&gt;&lt;P&gt;group by&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Item&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, you can prioritize your conditions from more strict to less strict and calculate the corresponding status. You can test the whole value of AllDivisions or test whether certain Division name is part of the value or not. Use the Index() function or the SubstringCount() function for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;P&gt;www.masterssummit.com - take your QlikView skills to the next level!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Feb 2015 01:12:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Append-field-into-table-based-on-another-table/m-p/762341#M1033373</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2015-02-07T01:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Append field into table based on another table</title>
      <link>https://community.qlik.com/t5/QlikView/Append-field-into-table-based-on-another-table/m-p/762342#M1033375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant, thank you.&amp;nbsp; I do need to figure out how to use Index() and SubstringCount() functions, but you have definitely got me past the first hurdle.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Feb 2015 01:35:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Append-field-into-table-based-on-another-table/m-p/762342#M1033375</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-02-07T01:35:22Z</dc:date>
    </item>
  </channel>
</rss>

