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: 
Anonymous
Not applicable

Help with IF statement?

Hello,

I know this is a basic question but I need a little help. Can you please tell me what is wrong with my IF statement.

if([Rule Desc]='2x per node',$(vNodePercent2),

if([Rule Desc]='1 per 3 DRC',$(v1p3DRC-2),

if([Rule Desc]='10-20% per node',$(v1p3DRC-2),

if([Rule Desc]='Additional license per node',$(vAdd2)))))

Thank you,

9 Replies
Clever_Anjos
Employee
Employee

What kind of error are you receiving?

Anonymous
Not applicable
Author

Error: Error in Expression ')' Expected

Thank you

swuehl
MVP
MVP

Have you checked that all variables expand to valid syntax?

And there is no typo in variables name?

Clever_Anjos
Employee
Employee

Weird, seems to be OK here, would you mind posting your screenshot?

Capturar.PNG

Anonymous
Not applicable
Author

I am not skilled at writing If statements. So I am sure its a closing bracket or something.


I was testing this in a text box. Because I want the value of the variable to show when a rules desc is showing.

Error.PNG

Anonymous
Not applicable
Author

What is -2 in $(v1p3DRC-2) and $(v1p3DRC-2)   ?

Are you trying to subtract 2 from the expression?

Then try below expression

=if([Rule Desc]='2x per node',$(vNodePercent2),

if([Rule Desc]='1 per 3 DRC',$(v1p3DRC)-2,

if([Rule Desc]='10-20% per node',$(v1p3DRC)-2,

if([Rule Desc]='Additional license per node', $(vAdd2))

)

)

)

Clever_Anjos
Employee
Employee

Please take a screenshot of your Properties / Edit Expression

Capturar.PNG

vardhancse
Specialist III
Specialist III

What is the value for $(v1p3DRC-2)..?

Anonymous
Not applicable
Author

I found the problem. There was no data for one of the variables. I was calcuation license count inside the variable. The part number I was working with didnt have a license count.

This is working fine.

if([Rule Desc]='2x per node',$(v2x),

if([Rule Desc]='10-20% per node',$(vNodePercent2),

if([Rule Desc]='1 per 3 DRC',$(v1p3DRC-2),

if([Rule Desc]='Additional license per node',$(vAdd2)))))

How do I add another field value. I want each row to have another field selection. I also need it to be And. What is the correct syntax.

Thank you for all the help. The comments above helped me troubleshoot the problem.

:O)