Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
phil_asmar
Partner - Contributor III
Partner - Contributor III

Expression does not work

Dear All,

Why does this not work:

if(

  count(EXECUTION_PLANNING_NAME1)>0 and IsNull(EXECUTION_PLANNING_NAME2),

  EXECUTION_PLANNING_NAME2,EXECUTION_PLANNING_NAME3

)

while this works:

if(

  count(EXECUTION_PLANNING_NAME1)>0 and IsNull(EXECUTION_PLANNING_NAME2),

  1,0

)


PS:EXECUTION_PLANNING_NAME2 AND EXECUTION_PLANNING_NAME3 ARE ATTRIBUTES AND NOT TEXT.


Thank you

15 Replies
Kushal_Chawda

try

if(

  count(EXECUTION_PLANNING_NAME1)>0 and IsNull(EXECUTION_PLANNING_NAME2),

  EXECUTION_PLANNING_NAME1,EXECUTION_PLANNING_NAME3

)

Anonymous
Not applicable

what is the Output?

in first Expression EXECUTION_PLANNING_NAME2 might be null and so in a table "-" would be displayed,

while in second Expression "1" would be displayed

WHat do you mean "does not work"

PrashantSangle

Hi,

what do you want to do with EXECUTION_PLANNING_NAME2,EXECUTION_PLANNING_NAME3

do you want to sum it or count of it

write sum(

if(

  count(EXECUTION_PLANNING_NAME1)>0 and IsNull(EXECUTION_PLANNING_NAME2),

  EXECUTION_PLANNING_NAME2,EXECUTION_PLANNING_NAME3

)

)

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
phil_asmar
Partner - Contributor III
Partner - Contributor III
Author

This is a listbox so when i put EXECUTION_PLANNING_NAME2, I WANT IT'S VALUES. I dont want to count or sum. Just the values inside EXECUTION_PLANNING_NAME2 as a list.

PrashantSangle

Hi,

also check your condition when

Condition count(EXECUTION_PLANNING_NAME1)>0 and IsNull(EXECUTION_PLANNING_NAME2) is true

then you are showing EXECUTION_PLANNING_NAME2 which is null

then you will get blank or - .

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
engishfaque
Specialist III
Specialist III

Dear Phil,

Please check this one,

=if(count (Len(Trim(EXECUTION_PLANNING_NAME1)))>0 and EXECUTION_PLANNING_NAME2 = '', EXECUTION_PLANNING_NAME2, EXECUTION_PLANNING_NAME3)

Please note, have you checked values in listed above fields 1, 2, and 3?

Kind regards,

Ishfaque Ahmed

hic
Former Employee
Former Employee

Your expression contains naked field references, i.e. field references that are not wrapped in aggregation functions. This will cause problems.

See Use Aggregation Functions!

HIC

phil_asmar
Partner - Contributor III
Partner - Contributor III
Author

EXECUTION_PLANNING_NAME1 and EXECUTION_PLANNING_NAME2 and EXECUTION_PLANNING_NAME3

all have values and are not null.

At any case, the if statement is either true or false so in any case it should return a dimension.

That is the problem, it is not returning anything!

phil_asmar
Partner - Contributor III
Partner - Contributor III
Author

i think that is my problem, but i dont want to use any of the sum or other aggregation functions. I only want to display all the attributes inside the dimension.

How would i do that?