Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
mfigueiredo
Contributor III
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
m_woolf
Master II
Master II

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.

Anonymous
Not applicable

try

=if(GetSelectedCount(GroupCd) > 1,

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

mfigueiredo
Contributor III
Contributor III
Author

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.

m_woolf
Master II
Master II

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
Contributor III
Contributor III
Author

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
Contributor III
Contributor III
Author

Hi,

I can try that.

Thank you.

Anonymous
Not applicable

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
Contributor III
Contributor III
Author

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
Partner
Partner

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