Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ioannagr
Creator III
Creator III

Problem with dual if operators

Hello everyone.

 

I seem to be facing an issue regarding "dual if" expression. So I have two variables, systolicpressure and diastolicpressure and I want to combine them in order to create categories for bloodpressure.

What I type is :

If(systolicpressure<=120 and diastolicpressure<=80,"normal",
If((systolicpressure>120 and systolicpressure<=129) and (diastolicpressure<=80),"elevated",
If((systolicpressure>=130 and systolicpressure<=139) or (diastolicpressure>80 and diastolicpressure<=89),"high blood pressure- hypertension stage 1",
If((systolicpressure>=140 and systolicpressure<180) or (diastolicpressure>=90 and diastolicpressure<120),"high blood pressure- hypertension stage 2",
If(systolicpressure>=180 and diastolicpressure>=120,"hypertensive crisis",
If(systolicpressure>=180 or diastolicpressure>=120,"hypertensive crisis", "null"))))))

 

I get the message: "missing right parenthesis" but this is not the case I believe; I tried a shorter version of this expression and it worked perfectly, but when the operator comes in I get error messages.

 

What am I doing wrong? Any help is appreciated.

 

Thank you,

Ioanna

Labels (3)
12 Replies
agigliotti
Partner - Champion
Partner - Champion

let's try replacing double quote " with single quote '.

ioannagr
Creator III
Creator III
Author

Hi and thank you for your reply.

Nope, problem still there.

Getting "missing right parenthesis".

 

Could it be something about the version I'm using?

Gysbert_Wassenaar

Replace the double quotes with single quotes. Then the syntax of the expression will be correct. Works for me anyway.

 

 


talk is cheap, supply exceeds demand
agigliotti
Partner - Champion
Partner - Champion

where are you using that expression?

ioannagr
Creator III
Creator III
Author

In the data manager.

ioannagr
Creator III
Creator III
Author

Using "calculated field" option.

ioannagr
Creator III
Creator III
Author

Hello Gysbert.

 

This is what I'm getting even if I replace with single quotes. 

Gysbert_Wassenaar

Data manager can't handle multiple conditions in an if statement. Bummer.

You can try nesting if's even further. Or just use the Data load editor instead.


talk is cheap, supply exceeds demand
ioannagr
Creator III
Creator III
Author

How are nested if's different to this expression I wrote? Maybe it's details I don't grasp at first glance. Seem pretty similar to me, if not the same.

 

Thank you for responding.

 

Ioanna