<?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 Calculation fields in the script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627178#M230464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the below script I am pulling two tables from two DB's and wanted to create few calculated fields using some conditions from the different tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like IF(CATE=67,(0-PRES),PRES) as Sales_Qty&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure how to achieve this, can you pls guide me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ODBC CONNECT TO ABC (XUserId is SSOKAKBJNSeA, XPassword is LJTQNKBNJLbaWQBW);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;CATE,&lt;/P&gt;&lt;P&gt;NO,&lt;/P&gt;&lt;P&gt;CLASS,&lt;/P&gt;&lt;P&gt;PRES,&lt;/P&gt;&lt;P&gt;DESC&lt;/P&gt;&lt;P&gt;'A' as Source;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "Master_File";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;WMNO as NO,&lt;/P&gt;&lt;P&gt;WBI,&lt;/P&gt;&lt;P&gt;WNMTH,&lt;/P&gt;&lt;P&gt;WMSK,&lt;/P&gt;&lt;P&gt;'WH A' AS WCmpy;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "Warehouse_Item_File";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ODBC CONNECT TO DEF (XUserId is SeLbIKBJNadB, XPassword is YNbSMKBNJLbaWQZJ);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;CATE,&lt;/P&gt;&lt;P&gt;NO,&lt;/P&gt;&lt;P&gt;CLASS,&lt;/P&gt;&lt;P&gt;PRES,&lt;/P&gt;&lt;P&gt;DESC&lt;/P&gt;&lt;P&gt;'B' as Source;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "Master_File";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;WMNO as NO,&lt;/P&gt;&lt;P&gt;WBI,&lt;/P&gt;&lt;P&gt;WNMTH,&lt;/P&gt;&lt;P&gt;WMSK,&lt;/P&gt;&lt;P&gt;'WH B' AS WCmpy;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "Warehouse_Item_File";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 25 May 2014 13:42:55 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-05-25T13:42:55Z</dc:date>
    <item>
      <title>Calculation fields in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627178#M230464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the below script I am pulling two tables from two DB's and wanted to create few calculated fields using some conditions from the different tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like IF(CATE=67,(0-PRES),PRES) as Sales_Qty&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure how to achieve this, can you pls guide me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ODBC CONNECT TO ABC (XUserId is SSOKAKBJNSeA, XPassword is LJTQNKBNJLbaWQBW);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;CATE,&lt;/P&gt;&lt;P&gt;NO,&lt;/P&gt;&lt;P&gt;CLASS,&lt;/P&gt;&lt;P&gt;PRES,&lt;/P&gt;&lt;P&gt;DESC&lt;/P&gt;&lt;P&gt;'A' as Source;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "Master_File";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;WMNO as NO,&lt;/P&gt;&lt;P&gt;WBI,&lt;/P&gt;&lt;P&gt;WNMTH,&lt;/P&gt;&lt;P&gt;WMSK,&lt;/P&gt;&lt;P&gt;'WH A' AS WCmpy;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "Warehouse_Item_File";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ODBC CONNECT TO DEF (XUserId is SeLbIKBJNadB, XPassword is YNbSMKBNJLbaWQZJ);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;CATE,&lt;/P&gt;&lt;P&gt;NO,&lt;/P&gt;&lt;P&gt;CLASS,&lt;/P&gt;&lt;P&gt;PRES,&lt;/P&gt;&lt;P&gt;DESC&lt;/P&gt;&lt;P&gt;'B' as Source;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "Master_File";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD &lt;/P&gt;&lt;P&gt;WMNO as NO,&lt;/P&gt;&lt;P&gt;WBI,&lt;/P&gt;&lt;P&gt;WNMTH,&lt;/P&gt;&lt;P&gt;WMSK,&lt;/P&gt;&lt;P&gt;'WH B' AS WCmpy;&lt;/P&gt;&lt;P&gt;SQL SELECT *&lt;/P&gt;&lt;P&gt;FROM "Warehouse_Item_File";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 May 2014 13:42:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627178#M230464</guid>
      <dc:creator />
      <dc:date>2014-05-25T13:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation fields in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627179#M230465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suppose&lt;/P&gt;&lt;P&gt;- at the end of your script you have 2 tables, the first one with table 1 (first db) and 3 (second db) concatenated, the second etc.....&lt;/P&gt;&lt;P&gt;- NO, Source is your logical key in first table&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;add this at the end; this code join your first table with your first table using NO and Source as join field and adds a field&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14010273270418164" jivemacro_uid="_14010273270418164"&gt;
&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14010273270389531" jivemacro_uid="_14010273270389531"&gt;
&lt;P&gt;&lt;EM&gt;left join (NameOFYourFirstTable)&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;LOAD&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;NO,&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;Source,&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;EM&gt;IF(CATE=67,(0-PRES),PRES) as Sales_Qty&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;resident&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;NameOFYourFirstTable;&lt;/EM&gt;&lt;/P&gt;

&lt;/PRE&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;

&lt;/PRE&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Another one (second condition doesn't apply for this)&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="_jivemacro_uid_14010273270337162 jive_text_macro jive_macro_code" jivemacro_uid="_14010273270337162"&gt;
&lt;PRE __default_attr="sql" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14010273270218617" jivemacro_uid="_14010273270218617"&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;rename &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;NameOFYourFirstTable&lt;/SPAN&gt; to TMP;&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;EM&gt;NameOFYourFirstTable:&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;noconcatenate&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;load &lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *,&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF(CATE=67,(0-PRES),PRES) as Sales_Qty&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;resident Tmp;&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;EM&gt;drop table Tmp;&lt;/EM&gt;&lt;/P&gt;
&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;

&lt;/PRE&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 May 2014 14:15:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627179#M230465</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2014-05-25T14:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation fields in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627180#M230466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks to like CATE and PRES are in the same table. If so, can't you just add the calc to the LOAD statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; IF(CATE=67,(0-PRES),PRES) as Sales_Qty&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;-Rob&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 May 2014 15:25:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627180#M230466</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2014-05-25T15:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation fields in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627181#M230467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope, typo error, if it comes from different table. Pls let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 01 Jun 2014 09:14:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627181#M230467</guid>
      <dc:creator />
      <dc:date>2014-06-01T09:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation fields in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627182#M230468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you pls let me know how to create calculated fields if it comes from two different tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 09:14:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627182#M230468</guid>
      <dc:creator />
      <dc:date>2014-06-03T09:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation fields in the script</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627183#M230469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Join or ApplyMap&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 09:23:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-fields-in-the-script/m-p/627183#M230469</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2014-06-03T09:23:58Z</dc:date>
    </item>
  </channel>
</rss>

