Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
dselgo_eidex
Partner - Creator III
Partner - Creator III

Set analysis not working when table is empty

Hello,

I bug showed up in our application that I thought was a little weird. Let's say that we have the following two tables:

Table A:

KEY YEAR
1 2022

 

Table B (empty):

KEY NAME

 

In this app I have a listbox which generates a list of the years available for records with a certain name in Table B. Its expression is:

 

=aggr(only({1<B.NAME = {'Foo'}>} DISTINCT A.YEAR), A.YEAR)

 

Normally this works fine, but when Table B is empty it results in "2022". I would expect it to result in NULL. Just using only returns the same:

 

=only({1<B.NAME = {'Foo'}>} DISTINCT A.YEAR)

 

Just wondering why this happens and if there is an easy way around it other than using an if statement.

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

It's not a bug else an intended behaviour respectively a side-effect. Set analysis evaluates the selection states of TRUE or FALSE which aren't available by NULL. Therefore these statements will be ignored (also if there is a none existing field specified). Of course Qlik might have been implemented any additionally logic before the evaluation to fetch such scenarios but it adds an overhead and they decided against it to speed up the performance.

- Marcus

View solution in original post

4 Replies
Digvijay_Singh

Pl check what do you see with below modification

=aggr(only({1<A.YEAR = P({<B.NAME={'Foo'}>})>} DISTINCT A.YEAR), A.YEAR)

marcus_sommer

It's not a bug else an intended behaviour respectively a side-effect. Set analysis evaluates the selection states of TRUE or FALSE which aren't available by NULL. Therefore these statements will be ignored (also if there is a none existing field specified). Of course Qlik might have been implemented any additionally logic before the evaluation to fetch such scenarios but it adds an overhead and they decided against it to speed up the performance.

- Marcus

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

I get the same behavior unfortunately.

dselgo_eidex
Partner - Creator III
Partner - Creator III
Author

Gotcha. Thanks for confirming this!