Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
pjpkumar26
Contributor III
Contributor III

Wildcard Query

Hi All

Using Wildcard function I have written the below code: 

WildMatch("Department ID",'D*')=1 and not Exists("Emp_ID","Employee ID");

By using this code I get all the Department Id starting D that's fine but in my data for few Department I got D-.

how can I ignore departments which as D- as well

Advance Thanks,

Sudheer

1 Solution

Accepted Solutions
wilsonwebbe
Contributor II
Contributor II

Awesome, then this is what is happening:
Your statement i including both and seems too confused to render the other. 

Do this preceding load instead. This give the query time to process the first section and then handle the second one after. I hope it makes sense:

LOAD *

WHERE NOT WildMatch("DepartmentID",'D-*');

LOAD *

WHERE WildMatch("DepartmentID",'D*')

View solution in original post

5 Replies
wilsonwebbe
Contributor II
Contributor II

I would  add,  "and not WildMatch("Department ID",'D-*')=1"

pjpkumar26
Contributor III
Contributor III
Author

Hi Wilson,

I used this code as mentioned but it ignore all the Dept

where WildMatch("DepartmentID",'D*' and 'D-*')=1 and not Exists("Dep_ID","Department ID");

Regards,

Sudheer

wilsonwebbe
Contributor II
Contributor II

Okay, I thinkt he question is.

 

DO you want D* to show?
Do you not want D-* to show?

 

If yes to both, then it should be 

WHERE WildMatch("DepartmentID",'D*') AND NOT WildMatch("DepartmentID",'D-*')

pjpkumar26
Contributor III
Contributor III
Author

Hi 

I got this code at the mom and it brings only Departments which start with D, but in the data one of the Department as D- which I don't want to show

where WildMatch("DepartmentID",'D*')=1 and not Exists("Dept","DepartmentID");

I am using this code as suggested  but still it bring D- in the sheet 

WHERE WildMatch("DepartmentID",'D*') AND NOT WildMatch("DepartmentID",'D-*')=1 and not Exists("Dept","DepartmentID");

Regards,

Sudheer

wilsonwebbe
Contributor II
Contributor II

Awesome, then this is what is happening:
Your statement i including both and seems too confused to render the other. 

Do this preceding load instead. This give the query time to process the first section and then handle the second one after. I hope it makes sense:

LOAD *

WHERE NOT WildMatch("DepartmentID",'D-*');

LOAD *

WHERE WildMatch("DepartmentID",'D*')