Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Straight Table Conditional Column Display

I have the attached QVW that I'm working on.  Multiple selections can be made in the HANDLERID ListBox and any rows which *contain* those values should be returned.  The Expressions ListBox allows the user to choose which columns will be displayed in the table.  If the user selects only the Handler column to be displayed, my example is working correctly.  If the user chooses any other column to be displayed along with the Handler column, my example falls apart... all rows are being returned - not just those which match the selections in the HANDLERID ListBox.  I understand that I could put the same logic in the remaining columns as I did for the Handler column within the table itself, however, this example is a very small sample of what I need to accomplish.  In the end there will be around 20 ListBoxes which will need to function like the HANDLERID ListBox and there will be somewhere around 75-100 filters in the Expressions ListBox.  Is there any other way I can account for this functionality that I need?

12 Replies
mov
Esteemed Contributor III

Re: Straight Table Conditional Column Display

Kerri,

You can solve it in one place - in the dimension.  Instead of using field ID as dimension, use calculated dimension, like this:

aggr(only({<HANDLER={$(vSearch)}>} ID),ID)

And, check "suppress when value is null).  Table will show ID rows only if there is HANDLER value (if this is what you need).

Regards,

Michael

Not applicable

Re: Straight Table Conditional Column Display

But what will I do when HANDLER is really 20 separate filters instead of just the 1?!  This seems like a very complex solution in that scenario.

mov
Esteemed Contributor III

Re: Re: Straight Table Conditional Column Display

It is somewhat complex, but it works.  And, notice that the expressions now are much simpler, no any conditions.  The differrence is that all the complexity is in only one place - in the calculated dimension.

Regards,

Michael

Not applicable

Re: Straight Table Conditional Column Display

I agree that it works, but with 20+ filters, is this really the "cleanest" way to handle the requirement?  How will the script look with 20 filters, not just HANDLER??

mov
Esteemed Contributor III

Re: Straight Table Conditional Column Display

(Trying to guess, not sure I understand this correctly)

If there are multiple search fields, you can create a variable for each - vSearch2, vSearch3 (better rename to someting more intuitive) - and include all in the same calculated dimension:

aggr(only({<HANDLER={$(vSearch)}, FILTER2={$(vSearch2), FILTER3={$(vSearch3), ... FILTER20={$(vSearch20)}>} ID),ID)

I'm not saying it is the best possible solution.  Let's see if somebody comes up with a cleaner one.

Regards,

Michael

Not applicable

Re: Straight Table Conditional Column Display

I've tried this solution and it works when there is a selection.  But when there is no selection made (all data to be shown), it falls apart.  There are a great number of rows missing in this scenario.

mov
Esteemed Contributor III

Re: Straight Table Conditional Column Display

I could've tried to guess again, but it is not very effective...  Can you upload an example?

Not applicable

Re: Straight Table Conditional Column Display

It is the previous example that you uploaded that I was using.  If you use that example, and make no selections, those records with have no values in the Handler field are missing from the table.

mov
Esteemed Contributor III

Re: Straight Table Conditional Column Display

I was sure that this was the requirement - don't show rows with missing Handler value.  Apparently I misunderstood you.

Can you explain on an example, e.g. this row should be shown (and why) but it is missing?

Or maybe there should be a separate condition for "no selection"?  That is, all HANDLERID selected is not the same as none selected (?)

Community Browser