<?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 Extracting from a GetFieldSelections result in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325036#M1196432</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not a perfect solution, but probably gives you an idea.&lt;/P&gt;&lt;P&gt;=left(SubField(GetFieldSelections(Name,','),',',N),2)&lt;/P&gt;&lt;P&gt;Replace N with 1 if you want the first selection, 2 for second selection ans so on. Ideally you would want to loop though to get all.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dinesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Apr 2011 17:38:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-04-28T17:38:24Z</dc:date>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325035#M1196431</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 have a list box with some names. It is possible to select more one name. I want to get the first two characters for each selected value in the GetFieldSelections(Name,','). Is it possible?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 17:18:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325035#M1196431</guid>
      <dc:creator />
      <dc:date>2011-04-28T17:18:05Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325036#M1196432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not a perfect solution, but probably gives you an idea.&lt;/P&gt;&lt;P&gt;=left(SubField(GetFieldSelections(Name,','),',',N),2)&lt;/P&gt;&lt;P&gt;Replace N with 1 if you want the first selection, 2 for second selection ans so on. Ideally you would want to loop though to get all.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dinesh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 17:38:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325036#M1196432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-04-28T17:38:24Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325037#M1196433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, thanks, but I'd like to obtain the dynamic result of your tip.&lt;/P&gt;&lt;P&gt;I'm interesting to get the all values.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 17:48:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325037#M1196433</guid>
      <dc:creator />
      <dc:date>2011-04-28T17:48:53Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325038#M1196434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you load another linked table that has the two character representations and use that field in your expression?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 19:04:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325038#M1196434</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2011-04-28T19:04:36Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325039#M1196435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There might be a simpler expression, but this appears to work.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;concat({1} if(index(getfieldselections(Name),Name),left(Name,2)),', ')&lt;/P&gt;&lt;P&gt;I assume you really want the selected names, not just the possible names. Possible names are much easier:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;concat(left(Name,2),', ')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2011 23:34:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325039#M1196435</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2011-04-28T23:34:45Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325040#M1196436</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;I have tried your expression but I have repetead substring of Name field (it is in a list box). I don't understand the use of Name in the Index statement after getfieldselections(Name). In this case, does Name contain the all possible values?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 07:48:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325040#M1196436</guid>
      <dc:creator />
      <dc:date>2011-04-29T07:48:01Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325041#M1196437</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'm solving with a VBScript macro that splits the content of the getfieldselections into an array of strings and then I get the substring for each array element.&lt;/P&gt;&lt;P&gt;I hope to don't use a macro.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 10:51:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325041#M1196437</guid>
      <dc:creator />
      <dc:date>2011-04-29T10:51:18Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325042#M1196438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To solve the duplicate issue:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concat(distinct if(index(getfieldselections(Name),Name),left(Name,2)),', ')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 11:54:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325042#M1196438</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-04-29T11:54:19Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325043#M1196439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, thanks.&lt;/P&gt;&lt;P&gt;It's a good and interesting alternative to the VBScript macro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 12:12:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325043#M1196439</guid>
      <dc:creator />
      <dc:date>2011-04-29T12:12:56Z</dc:date>
    </item>
    <item>
      <title>Extracting from a GetFieldSelections result</title>
      <link>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325044#M1196440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="jive_text_macro jive_macro_quote" jivemacro="quote"&gt;&lt;BR /&gt;Dinesh Thoniparambil wrote:concat(distinct if(index(getfieldselections(Name),Name),left(Name,2)),', ')&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;The removal of the {1} set means that you're now looking at the intersection of selected and possible values, not at all selected values. It is possible to have values selected that are not possible. Assuming you want to actually see ALL the selected values, you need to add that back in.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;concat(&lt;STRONG&gt;{1}&lt;/STRONG&gt; distinct if(index(getfieldselections(Name),Name),left(Name,2)),', ')&lt;/P&gt;&lt;P&gt;As for what's going on, let's say you've selected Andy, Bob and Carla, and not selected Dan or Erin. Let's say you then select value 'Male' in the field "Sex". Only Andy and Bob are now possible, but Andy, Bob and Carla are still selected, so getfieldselections(Name) returns the string 'Andy, Bob, Carla'. Now, concat() is an aggregation function. Think of it as a loop. In this case, we loop through names. Normally, it would just loop through possible names, so it would only loop through Andy and Bob. We also need it to loop through Carla, so we use the {1} set to make sure we loop through all names, not just possible names. So we consider each name in turn. First, Andy. We're doing this: index('Andy, Bob, Carla','Andy'). The substring 'Andy' is indeed in our list, in position 1, which is what the index() function returns. Anything non-zero is considered to be true, so the if() is true, and we go to the next part, left(Name,2). This returns 'An'. We keep looping. 'Bob' is position 7, true, so we return 'Bo'. 'Carla' is position 11, true, so we return 'Ca'. 'Dan' isn't in the string, so we return nothing. 'Erin' isn't in the string, so we return noting. So now we have values 'An', 'Bo' and 'Ca'. Distinct here does nothing since they all start with different two letters, but if we'd selected 'Annie' as well, the distinct would eliminate the duplicate. Finally we concatenate them all together with the string ', ' between each. Final result is 'An, Bo, Ca'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2011 18:58:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Extracting-from-a-GetFieldSelections-result/m-p/325044#M1196440</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2011-04-29T18:58:47Z</dc:date>
    </item>
  </channel>
</rss>

