Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
stjernvd
Contributor

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

Re: Using Wildmatch to group field values

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

Re: Using Wildmatch to group field values

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

Chanty4u
Esteemed Contributor III

Re: Using Wildmatch to group field values

  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
MVP & Luminary
MVP & Luminary

Re: Using Wildmatch to group field values

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


talk is cheap, supply exceeds demand

Re: Using Wildmatch to group field values

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

Re: Using Wildmatch to group field values

You left a parenthesis after Edinburgh

Capture.PNG

Re: Using Wildmatch to group field values

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

Re: Using Wildmatch to group field values

Agreed

I do that all the time