Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
raZor
Contributor III
Contributor III

Difference between not wildmatch and <>

Hi Qlikers,

I was using not wildmatch for restricting a value of column in script, it was also removing null values from that column and then I tried <> instead of not wildmatch which is not removing null values. Can anyone please tell me why not wildmatch is not working like <>? 

Regards,

Labels (5)
1 Solution

Accepted Solutions
Aditya_Chitale
Specialist
Specialist

You might want to modify where condition like this:

WHERE
 isnull(ColA) or Not(WildMatch(ColA, 'App*'));

 

Regards,

Aditya

View solution in original post

8 Replies
Aditya_Chitale
Specialist
Specialist

Ideally, both should work same. Can you share sample data and the where condition that you are using to restrict data ?

Regards,

Aditya

raZor
Contributor III
Contributor III
Author

The not wildmatch is not loading the data with NULL values.

 

Ex: 

 

Col A Linecd

 

Apple 1

 

Ball 2

 

Null 3

 

If I say "NOT WILDMATCH(COLA,'Apple')"" - the result is just 2 but ideally I should be getting 2 and 3 right? 

raZor
Contributor III
Contributor III
Author

Also <> is not working with ColA <> 'App*'

BrunPierre
Partner - Master
Partner - Master

The '<>' operator is generally used for exact matching and doesn't involve wildcard patterns.

The 'not WildMatch' is typically used to exclude values that match a specific wildcard pattern.

In this context, when using not WildMatch(ColA, 'App*'), the output would show 'Ball 2' and 'Null 3'.

steeefan
Luminary
Luminary

I was expecting the same, @BrunPierre. The result however differs:

 

Data:
NOCONCATENATE LOAD * INLINE [
  ColA, Linecd
  Apple, 1
  Ball, 2
];

CONCATENATE (Data) LOAD
  Null() AS ColA,
  3 AS Linecd
AutoGenerate
  1;

Test:
NOCONCATENATE LOAD
 *
RESIDENT
 Data
WHERE
 Not(WildMatch(ColA, 'App*'));

DROP TABLE Data;

This is the result I'm getting:

steeefan_0-1702286450040.png

 

Aditya_Chitale
Specialist
Specialist

You might want to modify where condition like this:

WHERE
 isnull(ColA) or Not(WildMatch(ColA, 'App*'));

 

Regards,

Aditya

steeefan
Luminary
Luminary

Yes, certainly. I would have however expected WildMatch() not to behave as shown.

Aditya_Chitale
Specialist
Specialist

Wildmatch() Returns expressions that match with provided match string/strings. 

Since it returns matching expression,  in current case, it won't find anything to return as value is null(). Maybe that's why it is returning only 1 entry.

 

Regards,

Aditya