Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
stjernvd
Partner - Creator
Partner - Creator

Using Wildmatch to group field values

Hi,

I am trying to group my fieldname 'Location' into 4 categories using WildMatch function, but it's not working, what am I doing wrong?

If(WildMatch(Location,'*London*','London',

      if(WildMatch(Location,'*Birmingham*'),'Birmingham',

      if(WildMatch(Location,'*Edinburgh*'),'Edinburgh',

      If(WildMatch(Location,'*US*'),'US')))),Location) as Location

The fieldname 'Location' has the following values:

Bleak Street, London

Liverpool Street, London

Praed Street, Birmingham

Commercial Street, Birmingham

Royal Street, Edinburgh

Princes Street, Edinburgh

US Location

And I want to take the key words 'London', 'Birmingham', Edinburgh', and 'US', to group locations into 4 categories in my 'Location' fieldname.

1 Solution

Accepted Solutions
sunny_talwar

May be this:

If(WildMatch(Location,'*London*'), 'London',

If(WildMatch(Location,'*Birmingham*'), 'Birmingham',

If(WildMatch(Location,'*Edinburgh*'), 'Edinburgh',

If(WildMatch(Location,'*US*'),'US', Location)))) as Location

View solution in original post

7 Replies
sunny_talwar

May be this:

If(WildMatch(Location,'*London*'), 'London',

If(WildMatch(Location,'*Birmingham*'), 'Birmingham',

If(WildMatch(Location,'*Edinburgh*'), 'Edinburgh',

If(WildMatch(Location,'*US*'),'US', Location)))) as Location

Chanty4u
MVP
MVP

  1. if(wildmatch(Location,'*London*'),'London',
  2. if(wildmatch(Location,'*Birmingham*'),'Birmingham',
  3. if(wildmatch(Location,'*Edinburgh*'),'Edinburgh',
  4. if(wildmatch(Location,'*US*'),'US',Location)))) as newlocation
Gysbert_Wassenaar

If(wildmatch(Location, 'US *', 'US', subfield(Location, ',',-1)) as Location


talk is cheap, supply exceeds demand
Kushal_Chawda

another way

If(Location like '*London*', 'London',

If(Location like '*Birmingham*', 'Birmingham',

If(Location like '*Edinburgh*', 'Edinburgh',

If(Location like '*US*' ,'US', Location)))) as Location

sunny_talwar

You left a parenthesis after Edinburgh

Capture.PNG

Kushal_Chawda

Updated. It's very difficult to modify copy pasted expression

sunny_talwar

Agreed

I do that all the time