<?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 script: new column based on range of string in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480930#M100764</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;im am trying to generate a new column based on a range of string values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;//something like if Alpha is in range 'A' to 'D' gen new column = 1, if not = 0
Load *,
if (Alpha = (stringRange, 'A', 'D'), 1, 0) as NewCol;

Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;How can I do this in Qlik sense?&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;
&lt;P&gt;Johannes&lt;/P&gt;</description>
    <pubDate>Wed, 11 Sep 2024 08:41:12 GMT</pubDate>
    <dc:creator>zeiherj</dc:creator>
    <dc:date>2024-09-11T08:41:12Z</dc:date>
    <item>
      <title>script: new column based on range of string</title>
      <link>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480930#M100764</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;im am trying to generate a new column based on a range of string values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;//something like if Alpha is in range 'A' to 'D' gen new column = 1, if not = 0
Load *,
if (Alpha = (stringRange, 'A', 'D'), 1, 0) as NewCol;

Characters:
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;How can I do this in Qlik sense?&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;
&lt;P&gt;Johannes&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 08:41:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480930#M100764</guid>
      <dc:creator>zeiherj</dc:creator>
      <dc:date>2024-09-11T08:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: script: new column based on range of string</title>
      <link>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480946#M100766</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/298159"&gt;@zeiherj&lt;/a&gt;&amp;nbsp; You already have number position for each characters in Num column so you can use that column to create a flag&lt;/P&gt;
&lt;P&gt;Load *,&lt;BR /&gt;&lt;STRONG&gt;if (Num &amp;lt;=4, 1, 0) as NewCol;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 26;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 09:18:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480946#M100766</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-11T09:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: script: new column based on range of string</title>
      <link>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480949#M100767</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt; Thanks for the propt response!&lt;/P&gt;
&lt;P&gt;Sorry, this was just sample data. Im am looking for a way to generate the new column based on the string column.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 09:23:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480949#M100767</guid>
      <dc:creator>zeiherj</dc:creator>
      <dc:date>2024-09-11T09:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: script: new column based on range of string</title>
      <link>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480953#M100768</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/298159"&gt;@zeiherj&lt;/a&gt;&amp;nbsp; What are the values in string column? Could you give some sample data examples?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 09:27:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480953#M100768</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-11T09:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: script: new column based on range of string</title>
      <link>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480955#M100769</link>
      <description>&lt;P&gt;ICD-Codes:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Load ICD inline 
[ICD
'A090'
'E713'
'J205'
'N100'
'N390'
'R310'
'T179'
'A020'
'A081'
'A099'
'A418'
'D550'
'D618'
'E713'
'G404'
'G932'
'H000'
'H601'
'J069'
'J101'
'J121'
'J210'
'J211'
'J218'
'J385'
'J390'];&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example for if-range statement: If ICD is in range from 'A000' to 'E999'&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 09:38:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480955#M100769</guid>
      <dc:creator>zeiherj</dc:creator>
      <dc:date>2024-09-11T09:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: script: new column based on range of string</title>
      <link>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480982#M100775</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/298159"&gt;@zeiherj&lt;/a&gt;&amp;nbsp; try below&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;map_characters:
Mapping Load Chr(RecNo()+Ord('A')-1) as Alpha, 
     RecNo() as Num 
autogenerate 26;

let vRangeStart = MapSubString('map_characters','A000');
let vRangeEnd = MapSubString('map_characters','E999');

ICD:
Load *,
     if(ICD_number &amp;gt;= $(vRangeStart) and ICD_number&amp;lt;= $(vRangeEnd),1,0) as flag;
Load *, 
     MapSubString('map_characters',ICD) as ICD_number 
inline [
ICD
'A090'
'E713'
'J205'
'N100'
'N390'
'R310'
'T179'
'A020'
'A081'
'A099'
'A418'
'D550'
'D618'
'E713'
'G404'
'G932'
'H000'
'H601'
'J069'
'J101'
'J121'
'J210'
'J211'
'J218'
'J385'
'J390'];&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-09-11 at 11.42.30.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/171525i03DDB8C5CC109030/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-09-11 at 11.42.30.png" alt="Screenshot 2024-09-11 at 11.42.30.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 10:42:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2480982#M100775</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-11T10:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: script: new column based on range of string</title>
      <link>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2481015#M100777</link>
      <description>&lt;P&gt;Thanks, &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;. Works perfectly!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 11:45:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/script-new-column-based-on-range-of-string/m-p/2481015#M100777</guid>
      <dc:creator>zeiherj</dc:creator>
      <dc:date>2024-09-11T11:45:17Z</dc:date>
    </item>
  </channel>
</rss>

