Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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

Tags (1)
1 Solution

Accepted Solutions
nagaiank
Valued Contributor III

Problem with if statement

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

Krishnamoorthy

4 Replies
erich_shiino
Honored Contributor

Problem with if statement

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
Valued Contributor III

Problem with if statement

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

Krishnamoorthy

Not applicable

Problem with if statement

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

nmellick

Employee
Employee

Problem with if statement

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

Community Browser