Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Highlighted
mfigueiredo
New Contributor III

Default List Box Selection - Exclude a value

Hi Qlik Community,

I've been trying to find this answer to this question, but with no sucess so far.

I have a List Box with several values, and a value that should always be excluded. This is the rule unless I need to generate a table/chart/text box with that information.

In short, it HAS to be there, but always excluded/filtered from same listbox.

However, when the user selects something in that listbox and than disselects, all values in that field are included. I don't want to condition all charts with set analysis, I think it would be easier to make a default state in a List Box.

Meaning if nothing is selected in the listbox, exclude that value.

So I want to use an expression in a List Box. Currently I have

=if(GetSelectedCount(GroupCd) > 1,

GroupCd, GroupCd =-'CONSUMPTION')

Clearly, I have my syntax wrong, and can't, for the life of me, get it to work.

Can you help me?

Thank you,

Mariana.

9 Replies
mwoolf
Honored Contributor II

Re: Default List Box Selection - Exclude a value

I don't understand why you don't just permanently exclude that value from the listbox.

The charts are built off the listbox. They are built off the underlying field, which still has all values.

Partner
Partner

Re: Default List Box Selection - Exclude a value

try

=if(GetSelectedCount(GroupCd) > 1,

GroupCd, if (GroupCd<>'CONSUMPTION',GroupCd))

mfigueiredo
New Contributor III

Re: Default List Box Selection - Exclude a value

Hi,

That doesn't work. I did exclude the value from the list box, but if I clear the field, the charts go back to including it.

Maybe another solution?

Thank you.

mwoolf
Honored Contributor II

Re: Default List Box Selection - Exclude a value

If you want the charts to exclude the value, why not create another field in script that down't include that value:

if (GroupCd<>'CONSUMPTION',GroupCd)) as GroupCdForCharts,

mfigueiredo
New Contributor III

Re: Default List Box Selection - Exclude a value

Hi Rudolf,

Thanks for your answer.

I tried your expression, however the result is that when I select a value, and then disselect, the list box excludes CONSUMPTION but includes this value in the charts.

Any other ideas?

Thank you,

Mariana

mfigueiredo
New Contributor III

Re: Default List Box Selection - Exclude a value

Hi,

I can try that.

Thank you.

Partner
Partner

Re: Default List Box Selection - Exclude a value

I suppose that you Need to work with set Analysis

or better way: exclude this value while loading your data in script

maybe other way round is better. what for you Need this value?

if so, create another table for selection of this value (might be diffcult due

to syntetic key etc.)

mfigueiredo
New Contributor III

Re: Default List Box Selection - Exclude a value

Hi Rudolf,

I agree, it seems easier.

Currently trying to grasp the syntax to exclude it from the script.

Thanks for your help,

Mariana.

cjohnson
Contributor II

Re: Default List Box Selection - Exclude a value

Hi Mariana,

Try the following syntax instead:

=if(GetSelectedCount(GroupCd) > 1,

GroupCd, IF(NOT MATCH(GroupCd, 'CONSUMPTION'), GroupCd))

See below for an example:

image14.png

Thanks,

Camile