<?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 List with excluded values in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206667#M62700</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I recommend creating an "Item Type with Work Order" field during the load. It simplifies and speeds up things like list boxes and charts that want to only display item types with work orders.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;,if(len("Work Order"),"Item Type") as "Item Type with Work Order"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Feb 2011 01:22:14 GMT</pubDate>
    <dc:creator>johnw</dc:creator>
    <dc:date>2011-02-09T01:22:14Z</dc:date>
    <item>
      <title>List with excluded values</title>
      <link>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206664#M62697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have some sample data that looks like the following:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Item Number&lt;/TD&gt;&lt;TD&gt;Item Type&lt;/TD&gt;&lt;TD&gt;Work Order&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;CON&lt;/TD&gt;&lt;TD&gt;100101&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ZYX&lt;/TD&gt;&lt;TD&gt;SHP&lt;/TD&gt;&lt;TD&gt;100103&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;YYZ&lt;/TD&gt;&lt;TD&gt;ROT&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;XYZ&lt;/TD&gt;&lt;TD&gt;CON&lt;/TD&gt;&lt;TD&gt;100104&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I want to be able to create a List box that shows only the Item Types that have a work order.&lt;/P&gt;&lt;P&gt;I used the expression: If(Len(WorkOrder)&amp;gt;0,ItemType)&lt;/P&gt;&lt;P&gt;Which worked, expect then if I selected the CON Item type it would select on both ItemType and the WorkOrder numbers. I want it to select only on ItemType.&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;-Ken&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 01:01:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206664#M62697</guid>
      <dc:creator />
      <dc:date>2011-02-09T01:01:35Z</dc:date>
    </item>
    <item>
      <title>List with excluded values</title>
      <link>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206665#M62698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ken,&lt;/P&gt;&lt;P&gt;If you add a Max() function around the WorkOrder field it'll just pick the latest work order ID instead of focusing on both, so this should work:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If(Len(Max(WorkOrder))&amp;gt;0,ItemType)&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 01:08:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206665#M62698</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-02-09T01:08:22Z</dc:date>
    </item>
    <item>
      <title>List with excluded values</title>
      <link>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206666#M62699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Johannes,&lt;/P&gt;&lt;P&gt;I gave that a try and it blanked out my list - showing no values. I tried both Max and MaxString (seem to get different results with them sometimes).&lt;/P&gt;&lt;P&gt;Just to confirm, I should be putting the expression into the General Field?&lt;/P&gt;&lt;P&gt;&lt;A href="http://community.qlik.com/cfs-file.ashx/__key/CommunityServer.Discussions.Components.Files/11/6811.List-Expression-Sample.png"&gt;&lt;IMG alt="" border="0" src="http://community.qlik.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Discussions.Components.Files/11/6811.List-Expression-Sample.png" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;-Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 01:20:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206666#M62699</guid>
      <dc:creator />
      <dc:date>2011-02-09T01:20:32Z</dc:date>
    </item>
    <item>
      <title>List with excluded values</title>
      <link>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206667#M62700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I recommend creating an "Item Type with Work Order" field during the load. It simplifies and speeds up things like list boxes and charts that want to only display item types with work orders.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;,if(len("Work Order"),"Item Type") as "Item Type with Work Order"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 01:22:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206667#M62700</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2011-02-09T01:22:14Z</dc:date>
    </item>
    <item>
      <title>List with excluded values</title>
      <link>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206668#M62701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, you're doing it as a listbox expression. In that case, try the following:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;=aggr(If(Len(Max(WorkOrder))&amp;gt;0,ItemType), ItemType)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Not necessarily the neatest way to accomplish this but it should do the trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;And with my comment on this not being the neatest approach, I definitely agree with JohnW that it's preferable to resolve this on the script side to reduce the complexity and calculations on the layout side.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 01:25:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206668#M62701</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-02-09T01:25:26Z</dc:date>
    </item>
    <item>
      <title>List with excluded values</title>
      <link>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206669#M62702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John: I considered that, but I'm joining results from two different ODBC data sources.&lt;/P&gt;&lt;P&gt;The first one contains: WorkOrder/ItemNumber&lt;/P&gt;&lt;P&gt;The second one contains: ItemNumber/ItemType&lt;/P&gt;&lt;P&gt;Is it possible to still do what you're suggesting in the script?&lt;/P&gt;&lt;P&gt;Johannes: That did the trick.. however if I select an item type, then only the currently selected value is visible. The others are all hidden instead of just going grey. Is there a way to avoid that (if only for future reference)?&lt;/P&gt;&lt;P&gt;-Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 01:41:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206669#M62702</guid>
      <dc:creator />
      <dc:date>2011-02-09T01:41:43Z</dc:date>
    </item>
    <item>
      <title>List with excluded values</title>
      <link>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206670#M62703</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;KenMKFC01 wrote: John: I considered that, but I'm joining results from two different ODBC data sources.&lt;BR /&gt;The first one contains: WorkOrder/ItemNumber&lt;BR /&gt;The second one contains: ItemNumber/ItemType&lt;BR /&gt;Is it possible to still do what you're suggesting in the script?&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Easy! (OK, John, then why is your post so long? We'll get to that.)&lt;/P&gt;&lt;P&gt;If the item number is in the work order table, then it has a work order. So you can just do this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;WorkOrders:&lt;BR /&gt;LOAD&lt;BR /&gt; WorkOrder&lt;BR /&gt;,ItemNumber&lt;BR /&gt;,ItemNumber as ItemNumberWithWorkOrder&lt;BR /&gt;FROM your ODBC source&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;It's denormalized to load it there, but that's not typically a problem for QlikView. If you want to renormalize the information anyway, perhaps just for the experience of doing so, you can. One "obvious" way is to join the values onto the Items table, continuing from the script above with this:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Items:&lt;BR /&gt;LOAD&lt;BR /&gt; ItemNumber&lt;BR /&gt;,ItemType&lt;BR /&gt;FROM your ODBC source&lt;BR /&gt;;&lt;BR /&gt;LEFT JOIN (Items)&lt;BR /&gt;LOAD DISTINCT&lt;BR /&gt; ItemNumber&lt;BR /&gt;,ItemNumberWithWorkOrder&lt;BR /&gt;RESIDENT WorkOrders&lt;BR /&gt;;&lt;BR /&gt;DROP FIELD ItemNumberWithWorkOrder FROM WorkOrders&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;But that left join with distinct is inefficient. Fortunately, there's a simpler and more efficient way.&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;Items:&lt;BR /&gt;LOAD&lt;BR /&gt; ItemNumber&lt;BR /&gt;,ItemType&lt;BR /&gt;,if(exists(ItemNumberWithWorkOrder,ItemNumber),ItemNumber) as ItemNumberWithWorkOrder&lt;BR /&gt;FROM your ODBC source&lt;BR /&gt;;&lt;BR /&gt;DROP FIELD ItemNumberWithWorkOrder FROM WorkOrders&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;That's probably what I'd use. But there's a way that might be slightly more efficient still, and also doesn't denormalize the data on the WorkOrders table even temporarily. Not that that matters, but just for fun:&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;WorkOrders:&lt;BR /&gt;LOAD&lt;BR /&gt; WorkOrder&lt;BR /&gt;,ItemNumber&lt;BR /&gt;FROM your ODBC source&lt;BR /&gt;;&lt;BR /&gt;ItemNumbersWithWorkOrders:&lt;BR /&gt;LOAD num(fieldvalue('ItemNumber',iterno())) as ItemNumberWithWorkOrder&lt;BR /&gt;AUTOGENERATE 1&lt;BR /&gt;WHILE len(fieldvalue('ItemNumber',iterno()))&lt;BR /&gt;;&lt;BR /&gt;Items:&lt;BR /&gt;LOAD&lt;BR /&gt; ItemNumber&lt;BR /&gt;,ItemType&lt;BR /&gt;,if(exists(ItemNumberWithWorkOrder,ItemNumber),ItemNumber) as ItemNumberWithWorkOrder&lt;BR /&gt;FROM your ODBC source&lt;BR /&gt;;&lt;BR /&gt;DROP TABLE ItemNumbersWithWorkOrders&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;I suspect it is faster to generate the extra table than it is to put an extra field on the WorkOrders table IF (and only if) there are a large number of work orders compared to the number of item numbers. Hard to say how it would play out in practice, and like I said, I probably wouldn't take it this far. The idea of the last script amused me, though.&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 02:17:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/List-with-excluded-values/m-p/206670#M62703</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2011-02-09T02:17:04Z</dc:date>
    </item>
  </channel>
</rss>

