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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with if statement

Hello,

I am trying to do a nested if.  The field I am evaluating can either be a number or text.  These are lab results.  The text part is when the lab enters a result like - '>15'.  If it is this, then I'm trying to put in a "1" into my flag field.  The statement is not even recognizing this part of my if statement and I can't figure out why.  Here's my statement:

if(num([Event Tag]) > 6, 1,

     if(text([Event Tag]) = '>15*', 1, 0))     as INR_Flag6

The first part will evaluate correctly, but the second part won't.  Any suggestions will be greatly appreciated!  I've tried everything I can think of to get this to work.

Thanks,

nmellick

1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

In the second 'if' statement, use 'like' operator instead of '='. I tried a sample script and it worked for me.

Krishnamoorthy

View solution in original post

4 Replies
erichshiino
Partner - Master
Partner - Master

Hi, I didn't understand what you are trying to accomplish with text([Event Tag]) = '>15*',

maybe you could work with part of the string.

For example,

num( left( [Event Tag],2) )> 15

This gets the two characters on the left, convert it to a number and check if it is higher than 15.

If it not it, please describe your if-condition

Rgds,

Erich

nagaiank
Specialist III
Specialist III

In the second 'if' statement, use 'like' operator instead of '='. I tried a sample script and it worked for me.

Krishnamoorthy

Not applicable
Author

Thanks to both of you for responding!  The "Like" word fixed my issue.

nmellick

Stefan_Walther
Employee
Employee

Hi,

if you are struggling with if-statements (like me ) maybe this can be helpfull:

http://www.qlikblog.at/464/tool-creating-nested-ifstatements/

Regards

Stefan