<?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 Count in Load Sciprt in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Count-in-Load-Sciprt/m-p/1650225#M48508</link>
    <description>&lt;P&gt;i am having a script error on the end of my script when i try to aggregate i can not figure out what is wrong with the script it run well expert for the count at the end any help would be greatly appreciated&lt;/P&gt;&lt;P&gt;[T188T]:&lt;BR /&gt;Mapping Load&lt;BR /&gt;// Key fields:&lt;BR /&gt;[KONDA],&lt;BR /&gt;[VTEXT] as [Price Group Descr.]&lt;BR /&gt;from $(vSources)T188T.qvd (qvd);&lt;/P&gt;&lt;P&gt;// consolidate the 3 tables of condition price :&lt;BR /&gt;[PRICE_COND]:&lt;BR /&gt;Load&lt;BR /&gt;VKORG as comp_price,&lt;BR /&gt;KUNNR as custo_price,&lt;BR /&gt;MATNR as mat_price,&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;DATBI as Valid_to_price,&lt;BR /&gt;DATAB as Valid_from_price,&lt;BR /&gt;'Customer / Material' as option&lt;BR /&gt;from $(vSources)A05.QVD (qvd)&lt;BR /&gt;where DATBI &amp;gt; date(today()) and DATAB &amp;lt;= date(today())&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//added&lt;BR /&gt;concatenate(PRICE_COND)&lt;BR /&gt;&lt;BR /&gt;Load&lt;BR /&gt;VKORG as comp_price,&lt;BR /&gt;KUNNR as custo_price,&lt;BR /&gt;MATNR as mat_price,&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;DATBI as Valid_to_price,&lt;BR /&gt;DATAB as Valid_from_price,&lt;BR /&gt;'ALL' as option&lt;BR /&gt;from $(vSources)A05.QVD (qvd)&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;//endadd&lt;BR /&gt;concatenate(PRICE_COND)&lt;BR /&gt;load&lt;BR /&gt;VKORG as comp_price,&lt;BR /&gt;KONDA as custo_grp_price,&lt;BR /&gt;ApplyMap('T188T',KONDA) as [Price Group Descr.],&lt;BR /&gt;MATNR as mat_price,&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;DATBI as Valid_to_price,&lt;BR /&gt;DATAB as Valid_from_price,&lt;BR /&gt;'Price Group / Material' as option&lt;BR /&gt;from $(vSources)A32.QVD (qvd)&lt;BR /&gt;where DATBI &amp;gt; date(today()) and DATAB &amp;lt;= date(today())&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;concatenate(PRICE_COND)&lt;BR /&gt;load&lt;BR /&gt;VKORG as comp_price,&lt;BR /&gt;MATNR as mat_price,&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;DATBI as Valid_to_price,&lt;BR /&gt;DATAB as Valid_from_price,&lt;BR /&gt;'Material with release status' as option&lt;BR /&gt;from $(vSources)A304.QVD (qvd)&lt;BR /&gt;where DATBI &amp;gt; date(today()) and DATAB &amp;lt;= date(today())&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;//link the condition price table with the pricing table (konp "normal price"/ konm "scale price")&lt;BR /&gt;NoConcatenate&lt;BR /&gt;PRICE_tmp:&lt;BR /&gt;load&lt;BR /&gt;comp_price,&lt;BR /&gt;custo_price,&lt;BR /&gt;custo_grp_price,&lt;BR /&gt;[Price Group Descr.],&lt;BR /&gt;mat_price,&lt;BR /&gt;cond_price,&lt;BR /&gt;Valid_to_price,&lt;BR /&gt;Valid_from_price,&lt;/P&gt;&lt;P&gt;[custo_grp_price]&amp;amp; '-' &amp;amp;[comp_price] as Pr_Group_Comp,&lt;BR /&gt;//[comp_price]&amp;amp; '-' &amp;amp;[mat_price] as Company_Material_Pric,&lt;BR /&gt;option&lt;BR /&gt;resident PRICE_COND;&lt;/P&gt;&lt;P&gt;left join(PRICE_tmp)&lt;BR /&gt;load&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;if(KZBZG = 'C', ' ', KBETR) as amount_price,&lt;BR /&gt;KPEIN as per_unit,&lt;BR /&gt;KMEIN as unit_of_measure,&lt;BR /&gt;KONWA as currency_price&lt;BR /&gt;from $(vSources)KONP.QVD (qvd);&lt;/P&gt;&lt;P&gt;left join(PRICE_tmp)&lt;BR /&gt;load&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;KSTBM as scale_price,&lt;BR /&gt;KBETR as amount_scale_price&lt;BR /&gt;from $(vSources)KONM.QVD (qvd);&lt;/P&gt;&lt;P&gt;drop table PRICE_COND;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Add the customer of price group&lt;BR /&gt;NoConcatenate&lt;BR /&gt;PRICE_tmp2:&lt;BR /&gt;load *&lt;BR /&gt;resident PRICE_tmp;&lt;/P&gt;&lt;P&gt;/*join(PRICE_tmp2)&lt;BR /&gt;load Pr_Group_Comp,&lt;BR /&gt;[KUNNR] as custo_price_grp&lt;BR /&gt;resident KNVV;&lt;BR /&gt;*/&lt;BR /&gt;//drop table KNVV;&lt;BR /&gt;drop table PRICE_tmp;&lt;/P&gt;&lt;P&gt;//rework the table&lt;BR /&gt;NoConcatenate&lt;BR /&gt;PRICE_tmp3:&lt;BR /&gt;load&lt;BR /&gt;//if (isnull(custo_price_grp),[comp_price]&amp;amp; '-' &amp;amp;[mat_price]&amp;amp; '-' &amp;amp; custo_price, [comp_price]&amp;amp; '-' &amp;amp;[mat_price]&amp;amp; '-' &amp;amp; custo_price_grp) as %Company_Material_Pric,&lt;BR /&gt;[comp_price]&amp;amp; '-' &amp;amp;[mat_price]&amp;amp; '-' &amp;amp; custo_price as %Company_Material_Pric,&lt;BR /&gt;comp_price,&lt;BR /&gt;//if (isnull(custo_price_grp), custo_price, custo_price_grp) as custo_price,&lt;BR /&gt;custo_price,&lt;BR /&gt;custo_grp_price,&lt;BR /&gt;[Price Group Descr.],&lt;BR /&gt;mat_price,&lt;BR /&gt;cond_price,&lt;BR /&gt;Valid_to_price,&lt;BR /&gt;Valid_from_price,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Company_Material_Pric,&lt;BR /&gt;option,&lt;BR /&gt;if (amount_price = ' ', amount_scale_price, amount_price) as amount_price,&lt;BR /&gt;per_unit,&lt;BR /&gt;unit_of_measure,&lt;BR /&gt;currency_price,&lt;BR /&gt;if (isnull(scale_price), '1', scale_price) as scale_price&lt;BR /&gt;resident PRICE_tmp2&lt;BR /&gt;where not isnull(mat_price);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;left join(PRICE_tmp3)&lt;BR /&gt;Load&lt;BR /&gt;KUNNR as custo_price,&lt;BR /&gt;[NAME1] as [Cust_price_Name],&lt;BR /&gt;KUNNR &amp;amp; ' - ' &amp;amp; NAME1 as [customer code &amp;amp; name price],&lt;BR /&gt;[KONZS] as [Corporate Group_Price]&lt;BR /&gt;from $(vSources)KNA1.qvd (qvd);&lt;/P&gt;&lt;P&gt;left join(PRICE_tmp3)&lt;BR /&gt;LOAD&lt;BR /&gt;MATNR as [mat_price],&lt;BR /&gt;VKORG as [comp_price],&lt;BR /&gt;KUNNR as [custo_price],&lt;BR /&gt;KDMAT as [Customer Part Price]&lt;BR /&gt;FROM&lt;BR /&gt;$(vSourcesShared)KNMT.QVD&lt;BR /&gt;(qvd);&lt;/P&gt;&lt;P&gt;left join(PRICE_tmp3)&lt;BR /&gt;Load&lt;BR /&gt;[KUNNR] as [custo_price],&lt;BR /&gt;[VKORG] as [comp_price],&lt;BR /&gt;[KONDA] as custo_grp_price&lt;BR /&gt;&lt;BR /&gt;FROM $(vSources)KNVV.QVD (qvd);&lt;/P&gt;&lt;P&gt;[PRICE]:&lt;BR /&gt;Load *,&lt;BR /&gt;Count(scale_price) as count_scale_price&lt;/P&gt;&lt;P&gt;resident PRICE_tmp3&lt;BR /&gt;group by custo_price, mat_price,comp_price ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;drop table PRICE_tmp2;&lt;BR /&gt;drop table PRICE_tmp3;&lt;/P&gt;&lt;P&gt;STORE [PRICE] INTO $(vDirectoryPath)PRICE.QVD;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2019 15:57:58 GMT</pubDate>
    <dc:creator>kylealpaugh</dc:creator>
    <dc:date>2019-11-22T15:57:58Z</dc:date>
    <item>
      <title>Count in Load Sciprt</title>
      <link>https://community.qlik.com/t5/App-Development/Count-in-Load-Sciprt/m-p/1650225#M48508</link>
      <description>&lt;P&gt;i am having a script error on the end of my script when i try to aggregate i can not figure out what is wrong with the script it run well expert for the count at the end any help would be greatly appreciated&lt;/P&gt;&lt;P&gt;[T188T]:&lt;BR /&gt;Mapping Load&lt;BR /&gt;// Key fields:&lt;BR /&gt;[KONDA],&lt;BR /&gt;[VTEXT] as [Price Group Descr.]&lt;BR /&gt;from $(vSources)T188T.qvd (qvd);&lt;/P&gt;&lt;P&gt;// consolidate the 3 tables of condition price :&lt;BR /&gt;[PRICE_COND]:&lt;BR /&gt;Load&lt;BR /&gt;VKORG as comp_price,&lt;BR /&gt;KUNNR as custo_price,&lt;BR /&gt;MATNR as mat_price,&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;DATBI as Valid_to_price,&lt;BR /&gt;DATAB as Valid_from_price,&lt;BR /&gt;'Customer / Material' as option&lt;BR /&gt;from $(vSources)A05.QVD (qvd)&lt;BR /&gt;where DATBI &amp;gt; date(today()) and DATAB &amp;lt;= date(today())&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//added&lt;BR /&gt;concatenate(PRICE_COND)&lt;BR /&gt;&lt;BR /&gt;Load&lt;BR /&gt;VKORG as comp_price,&lt;BR /&gt;KUNNR as custo_price,&lt;BR /&gt;MATNR as mat_price,&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;DATBI as Valid_to_price,&lt;BR /&gt;DATAB as Valid_from_price,&lt;BR /&gt;'ALL' as option&lt;BR /&gt;from $(vSources)A05.QVD (qvd)&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;//endadd&lt;BR /&gt;concatenate(PRICE_COND)&lt;BR /&gt;load&lt;BR /&gt;VKORG as comp_price,&lt;BR /&gt;KONDA as custo_grp_price,&lt;BR /&gt;ApplyMap('T188T',KONDA) as [Price Group Descr.],&lt;BR /&gt;MATNR as mat_price,&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;DATBI as Valid_to_price,&lt;BR /&gt;DATAB as Valid_from_price,&lt;BR /&gt;'Price Group / Material' as option&lt;BR /&gt;from $(vSources)A32.QVD (qvd)&lt;BR /&gt;where DATBI &amp;gt; date(today()) and DATAB &amp;lt;= date(today())&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;concatenate(PRICE_COND)&lt;BR /&gt;load&lt;BR /&gt;VKORG as comp_price,&lt;BR /&gt;MATNR as mat_price,&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;DATBI as Valid_to_price,&lt;BR /&gt;DATAB as Valid_from_price,&lt;BR /&gt;'Material with release status' as option&lt;BR /&gt;from $(vSources)A304.QVD (qvd)&lt;BR /&gt;where DATBI &amp;gt; date(today()) and DATAB &amp;lt;= date(today())&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;//link the condition price table with the pricing table (konp "normal price"/ konm "scale price")&lt;BR /&gt;NoConcatenate&lt;BR /&gt;PRICE_tmp:&lt;BR /&gt;load&lt;BR /&gt;comp_price,&lt;BR /&gt;custo_price,&lt;BR /&gt;custo_grp_price,&lt;BR /&gt;[Price Group Descr.],&lt;BR /&gt;mat_price,&lt;BR /&gt;cond_price,&lt;BR /&gt;Valid_to_price,&lt;BR /&gt;Valid_from_price,&lt;/P&gt;&lt;P&gt;[custo_grp_price]&amp;amp; '-' &amp;amp;[comp_price] as Pr_Group_Comp,&lt;BR /&gt;//[comp_price]&amp;amp; '-' &amp;amp;[mat_price] as Company_Material_Pric,&lt;BR /&gt;option&lt;BR /&gt;resident PRICE_COND;&lt;/P&gt;&lt;P&gt;left join(PRICE_tmp)&lt;BR /&gt;load&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;if(KZBZG = 'C', ' ', KBETR) as amount_price,&lt;BR /&gt;KPEIN as per_unit,&lt;BR /&gt;KMEIN as unit_of_measure,&lt;BR /&gt;KONWA as currency_price&lt;BR /&gt;from $(vSources)KONP.QVD (qvd);&lt;/P&gt;&lt;P&gt;left join(PRICE_tmp)&lt;BR /&gt;load&lt;BR /&gt;KNUMH as cond_price,&lt;BR /&gt;KSTBM as scale_price,&lt;BR /&gt;KBETR as amount_scale_price&lt;BR /&gt;from $(vSources)KONM.QVD (qvd);&lt;/P&gt;&lt;P&gt;drop table PRICE_COND;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Add the customer of price group&lt;BR /&gt;NoConcatenate&lt;BR /&gt;PRICE_tmp2:&lt;BR /&gt;load *&lt;BR /&gt;resident PRICE_tmp;&lt;/P&gt;&lt;P&gt;/*join(PRICE_tmp2)&lt;BR /&gt;load Pr_Group_Comp,&lt;BR /&gt;[KUNNR] as custo_price_grp&lt;BR /&gt;resident KNVV;&lt;BR /&gt;*/&lt;BR /&gt;//drop table KNVV;&lt;BR /&gt;drop table PRICE_tmp;&lt;/P&gt;&lt;P&gt;//rework the table&lt;BR /&gt;NoConcatenate&lt;BR /&gt;PRICE_tmp3:&lt;BR /&gt;load&lt;BR /&gt;//if (isnull(custo_price_grp),[comp_price]&amp;amp; '-' &amp;amp;[mat_price]&amp;amp; '-' &amp;amp; custo_price, [comp_price]&amp;amp; '-' &amp;amp;[mat_price]&amp;amp; '-' &amp;amp; custo_price_grp) as %Company_Material_Pric,&lt;BR /&gt;[comp_price]&amp;amp; '-' &amp;amp;[mat_price]&amp;amp; '-' &amp;amp; custo_price as %Company_Material_Pric,&lt;BR /&gt;comp_price,&lt;BR /&gt;//if (isnull(custo_price_grp), custo_price, custo_price_grp) as custo_price,&lt;BR /&gt;custo_price,&lt;BR /&gt;custo_grp_price,&lt;BR /&gt;[Price Group Descr.],&lt;BR /&gt;mat_price,&lt;BR /&gt;cond_price,&lt;BR /&gt;Valid_to_price,&lt;BR /&gt;Valid_from_price,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;//Company_Material_Pric,&lt;BR /&gt;option,&lt;BR /&gt;if (amount_price = ' ', amount_scale_price, amount_price) as amount_price,&lt;BR /&gt;per_unit,&lt;BR /&gt;unit_of_measure,&lt;BR /&gt;currency_price,&lt;BR /&gt;if (isnull(scale_price), '1', scale_price) as scale_price&lt;BR /&gt;resident PRICE_tmp2&lt;BR /&gt;where not isnull(mat_price);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;left join(PRICE_tmp3)&lt;BR /&gt;Load&lt;BR /&gt;KUNNR as custo_price,&lt;BR /&gt;[NAME1] as [Cust_price_Name],&lt;BR /&gt;KUNNR &amp;amp; ' - ' &amp;amp; NAME1 as [customer code &amp;amp; name price],&lt;BR /&gt;[KONZS] as [Corporate Group_Price]&lt;BR /&gt;from $(vSources)KNA1.qvd (qvd);&lt;/P&gt;&lt;P&gt;left join(PRICE_tmp3)&lt;BR /&gt;LOAD&lt;BR /&gt;MATNR as [mat_price],&lt;BR /&gt;VKORG as [comp_price],&lt;BR /&gt;KUNNR as [custo_price],&lt;BR /&gt;KDMAT as [Customer Part Price]&lt;BR /&gt;FROM&lt;BR /&gt;$(vSourcesShared)KNMT.QVD&lt;BR /&gt;(qvd);&lt;/P&gt;&lt;P&gt;left join(PRICE_tmp3)&lt;BR /&gt;Load&lt;BR /&gt;[KUNNR] as [custo_price],&lt;BR /&gt;[VKORG] as [comp_price],&lt;BR /&gt;[KONDA] as custo_grp_price&lt;BR /&gt;&lt;BR /&gt;FROM $(vSources)KNVV.QVD (qvd);&lt;/P&gt;&lt;P&gt;[PRICE]:&lt;BR /&gt;Load *,&lt;BR /&gt;Count(scale_price) as count_scale_price&lt;/P&gt;&lt;P&gt;resident PRICE_tmp3&lt;BR /&gt;group by custo_price, mat_price,comp_price ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;drop table PRICE_tmp2;&lt;BR /&gt;drop table PRICE_tmp3;&lt;/P&gt;&lt;P&gt;STORE [PRICE] INTO $(vDirectoryPath)PRICE.QVD;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 15:57:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-in-Load-Sciprt/m-p/1650225#M48508</guid>
      <dc:creator>kylealpaugh</dc:creator>
      <dc:date>2019-11-22T15:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Count in Load Sciprt</title>
      <link>https://community.qlik.com/t5/App-Development/Count-in-Load-Sciprt/m-p/1650238#M48512</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Here you are loading ALL fields from the PRICE_tmp3 table, but grouping by only few of them.&lt;/P&gt;&lt;P&gt;[PRICE]:&lt;BR /&gt;Load *,&lt;BR /&gt;Count(scale_price) as count_scale_price&lt;/P&gt;&lt;P&gt;resident PRICE_tmp3&lt;BR /&gt;group by &lt;FONT color="#FF0000"&gt;custo_price, mat_price,comp_price&lt;/FONT&gt; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to either group by all the fields (including the ones you're joining), or LOAD just the ones you are grouping by like so:&lt;/P&gt;&lt;P&gt;[PRICE]:&lt;BR /&gt;Load custo_price, mat_price,comp_price,&lt;BR /&gt;Count(scale_price) as count_scale_price&lt;/P&gt;&lt;P&gt;resident PRICE_tmp3&lt;BR /&gt;group by custo_price, mat_price,comp_price ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example for missing fields in the Group By clause: &lt;STRONG&gt;[Customer Part Price],&amp;nbsp;custo_grp_price&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope that helps!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;S.T.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 16:25:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Count-in-Load-Sciprt/m-p/1650238#M48512</guid>
      <dc:creator>Stoyan_Terziev</dc:creator>
      <dc:date>2019-11-22T16:25:43Z</dc:date>
    </item>
  </channel>
</rss>

