<?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 Assigning number to text expression in Script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236869#M87998</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the list is presorted by Indicator name, you could use the following load statement:&lt;/P&gt;&lt;P&gt;[Table A]:&lt;BR /&gt;LOAD&lt;BR /&gt;Year as YEAR,&lt;BR /&gt;Indicator_Name AS Series,&lt;BR /&gt;Values AS Fact,&lt;BR /&gt;if(rowno()=1,1,if(peek(Indicator_Name)=Indicator_Name,peek(Indicator_Key),Peek(Indicator_Key)+1)) as Indicator_Key&lt;BR /&gt;FROM&lt;BR /&gt;[Test.csv]&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jul 2010 01:25:24 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-07-29T01:25:24Z</dc:date>
    <item>
      <title>Assigning number to text expression in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236868#M87997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am working with the following script:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;I&gt;[Table A]:&lt;BR /&gt;L&lt;STRONG&gt;OAD&lt;BR /&gt;&lt;/STRONG&gt;&lt;/I&gt; Year &lt;B&gt;as&lt;/B&gt; YEAR,&lt;BR /&gt;Indicator_Name &lt;B&gt;AS&lt;/B&gt; Series,&lt;BR /&gt;Values &lt;B&gt;AS&lt;/B&gt; Fact&lt;BR /&gt;&lt;B&gt;FROM&lt;BR /&gt;&lt;/B&gt;[Test.csv]&lt;I&gt;&lt;/I&gt;&lt;P style="font-style: italic"&gt;&lt;/P&gt;&lt;P style="font-style: italic"&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;I&gt;&lt;/I&gt; &lt;P&gt;The Table looks a bit like this:&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The Table looks a bit like this:&lt;BR /&gt;&lt;/P&gt;Year Indicator_Name Values&lt;BR /&gt;2000 IndicA 50&lt;BR /&gt;2001 IndicA 60&lt;BR /&gt;2002 IndicA 70&lt;BR /&gt;2000 IndicB 50&lt;BR /&gt;2001 IndicB 60&lt;BR /&gt;2002 IndicB 70&lt;BR /&gt;2000 IndicC 50&lt;BR /&gt;2001 IndicC 60&lt;BR /&gt;2002 IndicC 70&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;What I would like to achieve, is to add a column with a Indicator_key, like this:&lt;/P&gt;&lt;P&gt;Year Indicator_Name Values Indicator_Key&lt;BR /&gt;2000 IndicA 50 1&lt;BR /&gt;2001 IndicA 60 1&lt;BR /&gt;2002 IndicA 70 1&lt;BR /&gt;2000 IndicB 50 2&lt;BR /&gt;2001 IndicB 60 2&lt;BR /&gt;2002 IndicB 70 2&lt;BR /&gt;2000 IndicC 50 3&lt;BR /&gt;2001 IndicC 60 3&lt;BR /&gt;2002 IndicC 70 3&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Now the tricky part is, I don't want to put the explicit texts of the Indicator_Name field in IF statements in my script.&lt;/STRONG&gt;&lt;BR /&gt;Rather, I am looking for a mechanism that will assing the Key 1 to the first Indicator_Name occurence, then, give the same Key to all the subsequent Name's that are the same as the first one, and add +1 to the Key for each new Name. I would do this on a list pre-sorted by Indicator name.&lt;/P&gt;&lt;P&gt;What are your thoughts on doing this?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jul 2010 23:23:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236868#M87997</guid>
      <dc:creator />
      <dc:date>2010-07-28T23:23:22Z</dc:date>
    </item>
    <item>
      <title>Assigning number to text expression in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236869#M87998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the list is presorted by Indicator name, you could use the following load statement:&lt;/P&gt;&lt;P&gt;[Table A]:&lt;BR /&gt;LOAD&lt;BR /&gt;Year as YEAR,&lt;BR /&gt;Indicator_Name AS Series,&lt;BR /&gt;Values AS Fact,&lt;BR /&gt;if(rowno()=1,1,if(peek(Indicator_Name)=Indicator_Name,peek(Indicator_Key),Peek(Indicator_Key)+1)) as Indicator_Key&lt;BR /&gt;FROM&lt;BR /&gt;[Test.csv]&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 01:25:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236869#M87998</guid>
      <dc:creator />
      <dc:date>2010-07-29T01:25:24Z</dc:date>
    </item>
    <item>
      <title>Assigning number to text expression in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236870#M87999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Tim,&lt;/P&gt;&lt;P&gt;If I understand the question correctly you want to generate an ID for every unique Indicator_Name. This can be done using the Autonumber function. Check the attached example document.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 05:07:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236870#M87999</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-29T05:07:59Z</dc:date>
    </item>
    <item>
      <title>Assigning number to text expression in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236871#M88000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Johannes,&lt;/P&gt;&lt;P&gt;This is really neat. Never thought of this. Thanks for pointing this out.&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 05:19:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236871#M88000</guid>
      <dc:creator />
      <dc:date>2010-07-29T05:19:48Z</dc:date>
    </item>
    <item>
      <title>Assigning number to text expression in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236872#M88001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're welcome Nimish,&lt;/P&gt;&lt;P&gt;As you know, there are always several possible ways to get the job done in the script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 05:31:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236872#M88001</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-07-29T05:31:55Z</dc:date>
    </item>
    <item>
      <title>Assigning number to text expression in Script</title>
      <link>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236873#M88002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks guys!&lt;BR /&gt;Good to see it is much easier than I feared it would be.&lt;/P&gt;&lt;P&gt;Tonight I will try to rebuild the script to see if it does what I want it to do &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 10:43:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Assigning-number-to-text-expression-in-Script/m-p/236873#M88002</guid>
      <dc:creator />
      <dc:date>2010-07-29T10:43:58Z</dc:date>
    </item>
  </channel>
</rss>

