Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Not applicable

Multiple if statement doesn't work?

Hello everyone.

I am using tree node extension to show structure of my application.

Tree node.png

I tried to make some simple text descriptions for an app.Specifically i made when node in tree is clicked text box is updated with description text.

My problem is that I am using multiple IF's to decide what node is selected and which text will be shown.


variable Opis:

If($(selectedNode)='1',opisPocetna,

If($(selectedNode)='2',opisStrukture,

if($(selectedNode)='3',opisRentabilnost,

if($(selectedNode)='4',opisAnaliza,

If($(selectedNode)='5',opisInfo,

If($(selectedNode)='6',opisRUCKD,'Default'))))))


It works only untill 6 IF statements.I tried to replace 'Default' with variable that contains antoher 6 and it worked.But it worked for 3 depths.

If($(selectedNode)='1',opisPocetna,

If($(selectedNode)='2',opisStrukture,

if($(selectedNode)='3',opisRentabilnost,

if($(selectedNode)='4',opisAnaliza,

If($(selectedNode)='5',opisInfo,

If($(selectedNode)='6',opisRUCKD,$(Opis1)))))))


I have 27 nodes and i can't pass 18 to work.Is there a way around this?

Switch/Case would be nice option but there is no one.

1 Solution

Accepted Solutions
Not applicable

Re: Multiple if statement doesn't work?

I mannaged to solve my own problem.

In case someone will find this answer usefull i will post it.

Frist i created 27 variables which contain description text.I called them Description1-Description27.

Each Description for one Node.

Then I created variable with expression to make string from word Description and NodeID number.

variable descriptionCreator

='Description'&$(selectedNode)

Change its value depending on node selection.

I used this statement to test which node is selected and what Description to show.

If($(selectedNode),$(descriptionCreator),'Default Text')

It worked perfectly.

1 Reply
Not applicable

Re: Multiple if statement doesn't work?

I mannaged to solve my own problem.

In case someone will find this answer usefull i will post it.

Frist i created 27 variables which contain description text.I called them Description1-Description27.

Each Description for one Node.

Then I created variable with expression to make string from word Description and NodeID number.

variable descriptionCreator

='Description'&$(selectedNode)

Change its value depending on node selection.

I used this statement to test which node is selected and what Description to show.

If($(selectedNode),$(descriptionCreator),'Default Text')

It worked perfectly.

Community Browser