Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to filter a table base on multiple NOT MATCH in multiple fields
Example:
[Filtered_Table]:
Load
F1,
F2,
F3,
F4
Resident [Previous_Loaded_Table]
where NOT MATCH(F1,'Condition1','Condition2')
and NOT MATCH(F2,'C1','C2','C3')
and NOT MATCH(F3,'Con')
and NOT MATCH(F4,'Cond');
however nothing gets filtered. thanks in advance.
I find that the logic for NOT and AND gets tricky in any programming language. Can you post some sample data that you have that should meet the filter test? And a row that should not?
-Rob
ID | F1 | F2 | F3 | F4 |
1 | c1 | anything | anything | anything |
2 | c2 | anything | anything | anything |
3 | anything | c11 | anything | anything |
4 | anything | c22 | anything | anything |
5 | anything | anything | c111 | anything |
6 | anything | anything | anything | c1111 |
7 | anything | anything | anything | c2222 |
8 | anything | anything | anything | anything |
9 | anythinge | anything | anything | anything |
A simplistic table would be the above where I only want to extract ID where
1. F1 not equal c1 or c2
or
2. F2 not equal c11 or c22
or
3. F3 not equal c111 or c222 or c333
or
4. F4 not equal c1111 or c2222
If this was the full table the result would be
ID |
8 |
9 |
Perhaps you just answered your own question 😀 You want OR instead of AND?
where NOT MATCH(F1,'Condition1','Condition2')
OR NOT MATCH(F2,'C1','C2','C3')
OR NOT MATCH(F3,'Con')
OR NOT MATCH(F4,'Cond');
-Rob
yes I've tried "OR" and it does nothing...
This seems to work for me. Are you sure you have the casing of your test values correct? You can use WildMatch() for a case insensitive comparison.
Load * Inline [
D F1 F2 F3 F4
1 c1 anything anything anything
2 c2 anything anything anything
3 anything c11 anything anything
4 anything c22 anything anything
5 anything anything c111 anything
6 anything anything anything c1111
7 anything anything anything c2222
8 anything anything anything anything
9 anything anything anything anything
] (delimiter is '\t')
where NOT MATCH(F1,'c1','c2')
and NOT MATCH(F2,'c11','c22')
and NOT MATCH(F3,'c111', 'c222', 'c333')
and NOT MATCH(F4,'c1111', 'c2222');
;
-Rob