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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
srinivasa1
Creator II
Creator II

etl script

Hi

why bellow where condtion is not working if  condtion is more then three in etl

where NAME<> 'A' OR NAME<> 'B' OR NAME<>'C'
OR NAME<>'D' OR NAME<>'E' OR NAME<>'F'
OR  NAME<>'AB' OR NAME<>'GH';

My name filed is like this while loading trim(Upper(SubField(AssignedReviewer,';'))) as AssignedReviewer,  is it creating any problem. pls guide me.

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Think this one through and you'll see that EVERY name matches your original condition.

Name A:  'A' <> 'A' OR 'A' <> 'B' => false OR true  => true
Name B:  'B' <> 'A' OR 'B' <> 'B' => true  OR false => true
Name X:  'X' <> 'A' OR 'X' <> 'B' => true  OR true  => true

As for why it still isn't working with the match(), at the time you're doing your where, the name is still from the input, not from the subfield breakdown.  I believe this would do the trick:

LOAD * WHERE not match(Name, 'HoldOutcomes', 'holdcharts', 'HoldMRA', 'HoldOutcomes', 'Invalid', 'InvalidReview', 'MRA', 'Outcomes');
LOAD
Name as tt
,subfield(Name,';') as Name
FROM test.txt
(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

View solution in original post

3 Replies
Not applicable

You should try to use the SubField Function with THREE Parameters (for details see documentation)

I assume you would have the first field?

trim(Upper(SubField(AssignedReviewer, ';', 1)))

Next your Statement seem to be "not working"

If

Name = 'X'

The condition is true, but also if

Name='A'

The condition is true (cause NAME <> 'B' is true an therefor at least one criteria is true and cause your chain is 'OR' one true is enough)

Which record you would have in your selection?

Which is the estimate result? All records with Name = 'A', 'B', 'C' ...

Or all records except these with Name = 'A', 'B', 'C' ... ?

Best regards

Michael

nagaiank
Specialist III
Specialist III

You may try any one of the following two scripts:

(1) Where Match(NAME,'A','B','C','D','E','F','AB','GH') = 0

(2) Substitute all the OR with AND in your script

johnw
Champion III
Champion III

Think this one through and you'll see that EVERY name matches your original condition.

Name A:  'A' <> 'A' OR 'A' <> 'B' => false OR true  => true
Name B:  'B' <> 'A' OR 'B' <> 'B' => true  OR false => true
Name X:  'X' <> 'A' OR 'X' <> 'B' => true  OR true  => true

As for why it still isn't working with the match(), at the time you're doing your where, the name is still from the input, not from the subfield breakdown.  I believe this would do the trick:

LOAD * WHERE not match(Name, 'HoldOutcomes', 'holdcharts', 'HoldMRA', 'HoldOutcomes', 'Invalid', 'InvalidReview', 'MRA', 'Outcomes');
LOAD
Name as tt
,subfield(Name,';') as Name
FROM test.txt
(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);