Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
steasy
Contributor III
Contributor III

Filter for calculated value of expression (problem with aggr()-function)

Hi! I'm using an expression in a Listbox L with multiple aggr()'s like the following:

 

 

 

if(account.activated = 'yes' and aggr(max({<user.id>}account.policy), user.id) <> 1 or aggr(max({<user.id>}account.policy), user.id) = 1 and account.activated = 'no', 'Not usable',
if(account.activated = 'yes' aggr(max({$}account.policy), user.id) = 1, 'Usable'))

 

 

 

What I'm doing here is to check:

  • is the account of an user activated, but haven't accepted the terms of use? OR has he accepted the terms of use, but the account is not activated? → mark it as 'Not usable'
  • is the account activated and did the user accept the terms of use? → mark it as 'Usable'
  • note: the $-sign, which I probably need is destructing my Tablebox T (occuring in the following text)

What I'm getting is Listbox L with two fields 'Usable' and 'Not usable'.

 

Next step I did was creating a Tablebox T with the user.id and a column 'Usable?' with a similar expression.

It's not a problem to filter in Listbox L between 'Usable' and 'Not usable' user accounts.

 

The strange problem is: If I'm selecting multiple (let's say 5) user.id's at first, it shows me the user.id's in column 1 and if their account is usable or not in column 'Usable?'. I'm able to press on my button 'Usable' from Listbox L and it only shows me 3 of 5 user.id's that are usable indeed. But if I'm pressing on my button 'Not usable' from Listbox L, it deselects my current selection and shows me all user.id's in my Tablebox T, that are not usable.

 

My assumption is, that I'm mixing something with the double aggr()-function, that I do not understand. Is there a mistake I fail to understand or are there any other ways to filter in my Tablebox T for 'Usable' and 'Not usable' after selecting multiple user.id's at first?

 

Thanks in advance (and for reading)

Labels (3)
1 Solution

Accepted Solutions
steasy
Contributor III
Contributor III
Author

I corrected the following

aggr(max({<user.id>}account.policy), user.id) <> 1

to

aggr(max({<user.id>}account.policy), user.id) = 0

altough I do not fully understand the reason, because there are only the possible values 0 and 1 and it shouldn't make a difference.

But the aggr()-function sometimes does magic stuff.

So for some documentation I'll leave this here

View solution in original post

1 Reply
steasy
Contributor III
Contributor III
Author

I corrected the following

aggr(max({<user.id>}account.policy), user.id) <> 1

to

aggr(max({<user.id>}account.policy), user.id) = 0

altough I do not fully understand the reason, because there are only the possible values 0 and 1 and it shouldn't make a difference.

But the aggr()-function sometimes does magic stuff.

So for some documentation I'll leave this here