Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditionals Chain

Hello!

I have the following conditionals on my script to mark with a flag if I have an anomaly or not:

   IF (FLAG_ANOMALY = 1, 'With Anomaly',

        IF (FLAG_ANOMALY = 0 AND FLAG_INSPECTION = 1, 'No Anomaly',

             'Pending'))   AS FLAG_ANOMALY_TYPE

The thing is that I get some rows with null and I want that everything that is not 'With Anomaly' / 'No Anomaly' get the value 'Pending'.

What could it be?

Thank you!!!

7 Replies
Not applicable
Author

IF (FLAG_ANOMALY = 0 AND FLAG_INSPECTION=1,'No Anomaly',IF(FLAG_ANOMALY=1,'With Anomaly','Pending'))



Not applicable
Author

The other thing is if you are adding new fields after your initial calculation i.e. concatenating new rows of data and you haven't included your if statement

Anonymous
Not applicable
Author

I assume that there are records where FLAG_ANOMALY is not 1 neither 0.  How do you want to handle this?

antoniotiman
Master III
Master III

In the Script use

NullAsValue  Flag_Anomaly ;

Set NullValue = 'Pending';

Regards

Not applicable
Author

But I previously have a table in my script where I do the following:

   IF (NOT ISNULL (ANOMALY_TYPE), 1, 0)   AS FLAG_ANOMALY,
  
IF (NOT ISNULL (INSPECTION_TYPE), 1, 0)   AS FLAG_INSPECTION

So I suppose I should assign a value for every type of anomaly...

If not, I'd like to put 'Pending' for the remaining records.

Anonymous
Not applicable
Author

In this case the response from Felim Shanaghy is what you need.

Not applicable
Author

Okay, I'm going to try it. Thank you!