Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
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
jonathandienst
Partner - Champion III
Partner - Champion III

If this is a chart expression it probably does not work because the naked field references* have multiple possible values at each row. In this case QV does not know which value to use and returns null (like the Only() function).

You will need to rewrite the expression to avoid the naked fields.

* A field name not enclosed in an aggregation function (like Sum(), Max(), Avg())

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
PrashantSangle

Hi,

Can you tell us, your logic with simple words or with example, So that it will become easier to help you

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

Basically i have a tree (hierarchy) !

EXECUTION_PLANNING_NAME1 is the root and under it the nodes

EXECUTION_PLANNING_NAME2, EXECUTION_PLANNING_NAME3,EXECUTION_PLANNING_NAME4 .....


I want, when a level (example: EXECUTION_PLANNING_NAME1 ) has values, and the next level (EXECUTION_PLANNING_NAME2) does not have values, then i want the EXECUTION_PLANNING_NAME1 because ot would be the last node in the tree that has values(i.e: child node)


I want to list all the nodes (EXECUTION_PLANNING_NAME1 in our example) inside a list box

phil_asmar
Partner - Contributor III
Partner - Contributor III
Author

how do you suggest i rewrite the statement to be able to display EXECUTION_PLANNING_NAME1 or EXECUTION_PLANNING_NAME2 in the listbox?

PrashantSangle

Hi,

In that case you need little modification in your expression.

try below

if(

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

  EXECUTION_PLANNING_NAME1,EXECUTION_PLANNING_NAME2

)

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

Dear Max,

The above still gives an error (it's not about which level im inserting). It's the fact that qlikview isnt displaying the values because of what i have read from other posts which is the naked field.