Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested If...ElseIf statement in a textbox -- possible?

It's me again

I'm so appreciative of the help that this community has provided me thus far on my initial jouney into QlikView.  I currently have a tab that when activated, automatically selects two values for my 'Question' field ('Group' and 'Self').  I have a text box that I want to display text in, but I want it to change depending on what the selection is.  I'm going to try to explain as best as I can.

If both 'Group' and 'Self' are selected (which is the default for the tab), I want to display "Total Productivity".  If only 'Group' is selected, I want to display "Group Productivity", and if only 'Self' is selected, display "Self Productivity".  If neither is selected, display nothing.

I wrote it out as this:

IF Question = 'Group' THEN

    IF Question = 'Self' THEN

          Text = "Total Productivity"

    ELSE

          Text = "Group Productivity"

ELSEIF Question = 'Self' THEN

    Text = "Self Productivity"

ELSE

    Text = blank

But I don't know how to format it for Qlik.  I tried this:

=If(Question='Group',If(Question='Self',"Total Productivity","Group Productivity"),If (Question='Self',"Self Productivity","")

But that doesn't seem to work.  Any help would be greatly appreciated.

Thanks,

Tim

16 Replies
sunny_talwar

I have seen that things selected with triggers sometime comes with ("Text1"|"Text2") in the current selection box. I would suggest creating a text box with GetFieldSelections(Question) and open the app (let the trigger go off) and then sending the text box object to excel. Copy and paste its content from Excel and paste it as an or statement:

=If(GetFieldSelections(Question)='Group, Self' or

     GetFieldSelections(Question) = 'NewText', 'Total Productivity',

If(GetFieldSelections(Question)='Group','Group Productivity',

If (GetFieldSelections(Question)='Self','Self Productivity',' ')))

Not applicable
Author

Hi, Sunny,

I think I understand what you're saying, but I'm a little bit confused about "Sending the text box object to excel" and "copy and paste its content from excel and paste it as an or statement".

So I'd create a text box with just "GetFieldSelections(Question) in it, which would get assigned the Group and Self questions.  I would then send that to Excel?  I'm not sure how I would do that.  Sorry again for my lack of QV knowledge.

Thanks,

Tim

sunny_talwar

Capture.PNG

Not applicable
Author

Sunny,

That did the trick.  I was confused -- I thought you meant that the new text box, and the sending to excel were going to always be part of the solution going forward, not just a one-time thing to get what is being stored.

Thanks again for all of the assistance!

Tim

sunny_talwar

Hahahaha, no it was just one time thing . I am glad you were finally able to figure it out. Although I would reward Kush's contribution as well because he was the one who came up with the expression. I just fine tuned it.

Thanks,

Sunny

Not applicable
Author

I wish I could select two correct answers, but you're right, special thanks to Kush!

sunny_talwar

You can always mark Helpful Answers in addition to correct answer. That option is within the Action button on the bottom left of the response.

Best,

Sunny