Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic listbox

Hi,

I have a list of Clients which is loaded twice in my script, once as Client and once as C_Client.

In my app, the Clients are loaded in separate list boxes based on the nr of Partners they have been served from in a given amount of time. At the moment, the list of Clients served by 0 Partners is has the following calculated dimension:

=if(aggr(count( distinct Partner)=0,  Client), Client)

I need to create a new list box made of all the C_Clients whose name match all the Clients that fall in the category above. I've tried the following calculated dimension but it doesn't work: =if(C_Client=if(aggr(count(distinct Partner)=0,  Client), Client), C_Client).

Can somebody help please?

Thanks!

15 Replies
Not applicable
Author

I love you!

Not applicable
Author

Hi Stefan,

I've realised I need to add another element to the expression. The e(Client) piece need to be related just to the possible Campaigns.

I've tried the following but neither seem to work - any idea?

=aggr( only({<C_Client = p({<Client = {"=sum(distinctPartner)=0"}>} Client)+e({<Campaign=p(Campaign)}>}Client) >} C_Client), C_Client)

=aggr( only({<C_Client = p({<Client = {"=sum(distinctPartner)=0"}>} Client)+e({<Campaign = {$(=GetFieldSelections (Campaign))}>}Client) >} C_Client), C_Client)

Thanks,

Linda

swuehl
MVP
MVP

I can't see Campaign field in your sample file. Would be good if you could update your sample.

And it would also be helpful if you could explicitely state what your expect to see when selecting in fields (some sample scenarios).

Not applicable
Author

Hi,

Sorry... sample file attached.

Example:

Campaign 1 has a total of 6 Clients so if I select it our C_Client = Client with 0 Partners attempt listbox should only show the Clients with 0 Partners included in that Campaign, that is to say the ones that you can see in red. If we select Year 2012 on top of that, then C_Client = Client with 0 Partners should show the list below - that is to say the Clients with 0 Partners that are included in Campaign 1.

BJNIT PWG / Kfqsrxr

JAI JBAM GCPDYNE XGQATLHH (PGHDESS) KYOTQZG / Ihotgke

MHGLZ RÜFGX BRYO & WY FQ / Esusrrf

Finally, if nothing is selected in the Campaign field, the list should work as it already does.

To sum up, when one or more Campaigns are selected, the scope of the listbox should be reduced to those Campaign only and further selections should work on top of that. With no Campaigns, the list should work on the entire pool of Clients, which exactly what it does with the latest calculate dimension you suggested.

I've been trying this on my end, which works as long as I only make selections in the Campaign field or everywhere else. However, if I cobine selections in any field AND Campaign it shows nothing.

=if(GetSelectedCount(Campaign)>=1,

aggr( only({<C_Client = p({<Client = {"=sum(distinctPartner)=0"}>} Client) >} C_Client), C_Client),

if(GetSelectedCount(Campaign)=0,

aggr( only({<C_Client = p({<Client = {"=sum(distinctPartner)=0"}>} Client)+e(Client) >} C_Client), C_Client)))

Not sure what else I could test...

Thanks,

Linda

swuehl
MVP
MVP

Try

=

aggr( only({<C_Client = (p({<Client = {"=sum(distinctPartner)=0"}>} Client)+e(Client))*p({1<Campaign=p(Campaign)>}Client) >} C_Client), C_Client)

Not applicable
Author

Hi,

Thanks! I think this could work but need to test it on the real thing first in case I've overlooked some of the implications.

Will keep you posted.

Linda