<?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 Create grouped field name in script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Create-grouped-field-name-in-script/m-p/1939439#M77439</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I am looking for a solution which would allow me to somehow group field in a script. I am showing number of workers per country and do not want to show separate country name if its headcount is less than 3 people.&lt;/P&gt;
&lt;P&gt;I have managed to achieve this by creating custom dimension as below:&lt;/P&gt;
&lt;P&gt;if(aggr(Count([Employee ID]),Country)&amp;lt;3,'Other',Country)&lt;/P&gt;
&lt;P&gt;However user is still able to identify which countries belong to this 'Other' category as filter selection on the country field appears on the top of the sheet.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought I should somehow achieve same result by using grouping in the script as below:&lt;/P&gt;
&lt;P&gt;MYTABLE:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;ID | Country&lt;/P&gt;
&lt;P&gt;E1 | China&lt;/P&gt;
&lt;P&gt;E2 | China&lt;/P&gt;
&lt;P&gt;E3 | China&lt;/P&gt;
&lt;P&gt;E4 | India&lt;/P&gt;
&lt;P&gt;E5 | India&lt;/P&gt;
&lt;P&gt;E6 | Japan&lt;/P&gt;
&lt;P&gt;E7 | Japan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LEFT JOIN (MYTABLE)&lt;BR /&gt;Load &lt;BR /&gt;&amp;nbsp;ID,&lt;BR /&gt;&amp;nbsp;If(count([ID])&amp;lt;3,Country,'Other') as Country &lt;BR /&gt;&lt;BR /&gt;Resident MYTABLE&lt;BR /&gt;Group By ID;&lt;/P&gt;
&lt;P&gt;Drop Field Country from MYTABLE;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but I am keep getting invalid expression error. Does anyone have any idea if it's possible to achieve this result in script?&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jun 2022 13:10:42 GMT</pubDate>
    <dc:creator>iczkla</dc:creator>
    <dc:date>2022-06-03T13:10:42Z</dc:date>
    <item>
      <title>Create grouped field name in script</title>
      <link>https://community.qlik.com/t5/App-Development/Create-grouped-field-name-in-script/m-p/1939439#M77439</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I am looking for a solution which would allow me to somehow group field in a script. I am showing number of workers per country and do not want to show separate country name if its headcount is less than 3 people.&lt;/P&gt;
&lt;P&gt;I have managed to achieve this by creating custom dimension as below:&lt;/P&gt;
&lt;P&gt;if(aggr(Count([Employee ID]),Country)&amp;lt;3,'Other',Country)&lt;/P&gt;
&lt;P&gt;However user is still able to identify which countries belong to this 'Other' category as filter selection on the country field appears on the top of the sheet.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought I should somehow achieve same result by using grouping in the script as below:&lt;/P&gt;
&lt;P&gt;MYTABLE:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;ID | Country&lt;/P&gt;
&lt;P&gt;E1 | China&lt;/P&gt;
&lt;P&gt;E2 | China&lt;/P&gt;
&lt;P&gt;E3 | China&lt;/P&gt;
&lt;P&gt;E4 | India&lt;/P&gt;
&lt;P&gt;E5 | India&lt;/P&gt;
&lt;P&gt;E6 | Japan&lt;/P&gt;
&lt;P&gt;E7 | Japan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LEFT JOIN (MYTABLE)&lt;BR /&gt;Load &lt;BR /&gt;&amp;nbsp;ID,&lt;BR /&gt;&amp;nbsp;If(count([ID])&amp;lt;3,Country,'Other') as Country &lt;BR /&gt;&lt;BR /&gt;Resident MYTABLE&lt;BR /&gt;Group By ID;&lt;/P&gt;
&lt;P&gt;Drop Field Country from MYTABLE;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but I am keep getting invalid expression error. Does anyone have any idea if it's possible to achieve this result in script?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 13:10:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Create-grouped-field-name-in-script/m-p/1939439#M77439</guid>
      <dc:creator>iczkla</dc:creator>
      <dc:date>2022-06-03T13:10:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create grouped field name in script</title>
      <link>https://community.qlik.com/t5/App-Development/Create-grouped-field-name-in-script/m-p/1939451#M77442</link>
      <description>&lt;P&gt;The count and the check must be done in two separate steps. Beside this your aggregation needs to be reversed in regard to the included fields. I would probably going in this direction:&lt;/P&gt;
&lt;P&gt;m: mapping load Country, count(ID) from Source group by Country;&lt;/P&gt;
&lt;P&gt;t: load ID, if(applymap('m', Country, 0) &amp;lt; 3, 'Other', Country) as Country from Source;&lt;/P&gt;
&lt;P&gt;- Marcus&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jun 2022 13:26:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Create-grouped-field-name-in-script/m-p/1939451#M77442</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2022-06-03T13:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create grouped field name in script</title>
      <link>https://community.qlik.com/t5/App-Development/Create-grouped-field-name-in-script/m-p/1939707#M77466</link>
      <description>&lt;P&gt;Worked like a charm, thank you Marcus!&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 10:50:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Create-grouped-field-name-in-script/m-p/1939707#M77466</guid>
      <dc:creator>iczkla</dc:creator>
      <dc:date>2022-06-05T10:50:56Z</dc:date>
    </item>
  </channel>
</rss>

