<?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 Problem with Column of fields in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235158#M86445</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I misunderstood.&lt;/P&gt;&lt;P&gt;I posted a sample. Is that what you're looking for? I had to use an if...then, I don't know if there is an easier way to do it. I also suppose that your real project is more complicated than the example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Feb 2010 18:30:03 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-02-09T18:30:03Z</dc:date>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235155#M86442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;I have a problem which bothers me a lot. And I hope anyone of you can help me...&lt;/P&gt;&lt;P&gt;In my data model I have 3 different fields, called Col1, Col2 and Col3. Furthermore I have a field relevantCol which consists of the names of the three fields before. Now I would like to create an expression which returns the values of the columns mentioned in relevantCol.&lt;/P&gt;&lt;P&gt;I tried to use the expression&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;&lt;/P&gt;&lt;P style="font-style: italic; font-weight: bold"&gt;$(=relevantCol)&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P style="font-style: italic"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But this works only if one unique relevantCol has been chosen.&lt;/P&gt;&lt;P&gt;I think it will be clear if you have a look at the attached qvw. Just choose one item under relevantCol.&lt;/P&gt;&lt;P&gt;Is it possible to modify the expression in a way that it shows always the correct value?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 17:44:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235155#M86442</guid>
      <dc:creator />
      <dc:date>2010-02-09T17:44:08Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235156#M86443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you want:&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;GetFieldSelections(relevantCol)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 17:55:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235156#M86443</guid>
      <dc:creator />
      <dc:date>2010-02-09T17:55:57Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235157#M86444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;but I don't want the field names of the selected columns. I need the values of the listed columns under relevantCol:&lt;/P&gt;&lt;P&gt;NeededCol&lt;/P&gt;&lt;P&gt;a1&lt;/P&gt;&lt;P&gt;a2&lt;/P&gt;&lt;P&gt;b3&lt;/P&gt;&lt;P&gt;a4&lt;/P&gt;&lt;P&gt;b5&lt;/P&gt;&lt;P&gt;c6&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 18:22:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235157#M86444</guid>
      <dc:creator />
      <dc:date>2010-02-09T18:22:43Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235158#M86445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I misunderstood.&lt;/P&gt;&lt;P&gt;I posted a sample. Is that what you're looking for? I had to use an if...then, I don't know if there is an easier way to do it. I also suppose that your real project is more complicated than the example.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 18:30:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235158#M86445</guid>
      <dc:creator />
      <dc:date>2010-02-09T18:30:03Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235159#M86446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately it is, indeed. The result is exactly what I am looking for. But I need it in a more abstract solution cause there will be more columns than 1 to 3. But it's not clear how much more, cause they can will be added dynamically.&lt;/P&gt;&lt;P&gt;I need something like lookup for charts. But unfortunately this function is only support in the script. But I don't want to implement this in the script (for other reasons...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 18:39:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235159#M86446</guid>
      <dc:creator />
      <dc:date>2010-02-09T18:39:26Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235160#M86447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can add a "Row" field to use as an index in your data table, you could use a FieldValue() function like this:&lt;/P&gt;&lt;P&gt;=FieldValue(relevantCol, Row)&lt;/P&gt;&lt;P&gt;Note the absence of quotes around relevantCol, causing the value of relevantCol to be used. If you have more than one row per dimension you will have to use aggregation expressions to get relevantCol and Row.&lt;/P&gt;&lt;P&gt;Example attached.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 20:27:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235160#M86447</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-02-09T20:27:02Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235161#M86448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Rob,&lt;/P&gt;&lt;P&gt;My experience is that FieldValue function works only if disctinct values are present in all the rows of the lookup value column. Even in your example, if you repeat any value in the Col1,Col2,Col3 the lookup value will not come correctly.&lt;/P&gt;&lt;P&gt;Please let me know if this understanding is correct.&lt;/P&gt;&lt;P&gt;Nimish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 20:42:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235161#M86448</guid>
      <dc:creator />
      <dc:date>2010-02-09T20:42:42Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235162#M86449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ouch. Nimish, you are correct. FieldValue holds the distinct values, not the number of rows. My example won't work.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Feb 2010 20:55:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235162#M86449</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-02-09T20:55:30Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235163#M86450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;I also thought already about FieldValue, which failed as you already mentioned because of the value which do not have to be distinct...&lt;/P&gt;&lt;P&gt;But maybe s.o. else has a solution?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Feb 2010 11:05:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235163#M86450</guid>
      <dc:creator />
      <dc:date>2010-02-10T11:05:20Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235164#M86451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This one drove my crazy. Seems there ought to be a way. If you could build in the script a variation of NMillers sugestion. An expression like:&lt;/P&gt;&lt;P&gt;=pick(match(relevantCol, 'Col1', 'Col2', 'Col3'), Col1, Col2, Col3)&lt;/P&gt;&lt;P&gt;I think that would do the trick. If you didn't want to do anything in the script, you could build it dynamically. Assign the following expression to a variable (vPickExpr):&lt;/P&gt;&lt;P&gt;='pick(match(relevantCol, ' &amp;amp; chr(39) &amp;amp; concat($Field,chr(39) &amp;amp; ',' &amp;amp; chr(39)) &amp;amp; chr(39) &amp;amp; '), ' &amp;amp; concat($Field, ',') &amp;amp; ')'&lt;/P&gt;&lt;P&gt;and then use&lt;/P&gt;&lt;P&gt;=$(vPickExpr)&lt;/P&gt;&lt;P&gt;as your chart expression. It includes all the Fields in the model, but gives the correct result given your sample data. Don't know how it would scale up.&lt;/P&gt;&lt;P&gt;Example attached including some columns not related to the chart.&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 01:58:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235164#M86451</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-02-11T01:58:11Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235165#M86452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great solution!&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Unfortunately, I can't use this expression cause of performance reasons... (I need this formula about 10 times for ca. 1 Mio rows.)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But that was exactly what I needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Dae-Wie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 14:47:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235165#M86452</guid>
      <dc:creator />
      <dc:date>2010-02-11T14:47:35Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235166#M86453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dae-Wie,&lt;/P&gt;&lt;P&gt;I'm sorry the performannce didn't work out.&lt;/P&gt;&lt;P&gt;I'm curious about the scenario you are trying to use this in. Can you describe your real world applicaion of this?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 16:57:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235166#M86453</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2010-02-11T16:57:09Z</dc:date>
    </item>
    <item>
      <title>Problem with Column of fields</title>
      <link>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235167#M86454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It seems like we should be able to do evaluate(relevantCol). But QlikView explicitly disallows this function in charts. Why? No idea!&lt;/P&gt;&lt;P&gt;I'm guessing that the pick(match()) approach is slow because it's doing so very much string manipulation when setting up the variable. If it's doing it for every row of the chart, which seems likely, then that could certainly bog you down.&lt;/P&gt;&lt;P&gt;But maybe we're reading too much into where you said "...there will be more columns than 1 to 3. But it's not clear how much more, cause they can will be added dynamically."&lt;/P&gt;&lt;P&gt;What do you MEAN by added dynamically? You can't actually create fields anywhere but in the script. The only fields that can be referenced are fields loaded in the script. So I would think that building the variable in the script would be perfectly safe. But I'm not sure I'd even go that far. I think I'd just write the expression in the chart, and remember that if I add a field to the script that I want to use in the chart, I have to add it to the chart.&lt;/P&gt;&lt;P&gt;So I'm recommending that, for performance reasons, you simply use Rob's original expression (formatted below for easier verification that your literals match your field names):&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;pick(match(relevantCol&lt;BR /&gt;,'Col1','Col2','Col3')&lt;BR /&gt;, Col1 , Col2 , Col3 )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Feb 2010 22:54:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Problem-with-Column-of-fields/m-p/235167#M86454</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2010-02-11T22:54:06Z</dc:date>
    </item>
  </channel>
</rss>

