Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
anuradhaa
Partner - Creator II
Partner - Creator II

Using Wildmatch() to extract Words

Hi,

I have sentences in my column called labels.

ex -

03/02/2016 dfdfd, dgfidgfid, cust_abc

03/02/2016 dfdfd, dgfidgfid, cust_art, gdeugd

I want to get the word "cust_*" and split it "_" and get the 2nd potion.

ex - cust_abc ---> abc

I'm using below sysntax

If(WildMatch(Lable, 'cust_'), SubField(Lable, 'cust_', 2),'aaa') as Customer

but it always gives 'aaa'

Thanks

4 Replies
Kushal_Chawda

try

If(WildMatch(lower(Lable), 'cust_*'), SubField(Lable, '_', 2),'aaa') as Customer


or



if( lower(Lable) like 'cust_*', SubField(Lable, '_', 2),'aaa') as Customer

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

If(WildMatch(Lable, '*cust_*'), SubField(Lable, 'cust_', 2)) as Customer


-Rob

sunny_talwar

Not sure if you need everything after cust_ or just the three letters or if the stuff after cust_ is variable, but I used Rob's code and tried make minor modification to pick only left 3 letters. May be this is not what you want, but I thought I would still share

Table:

LOAD Lable,

  If(WildMatch(Lable, '*cust_*'), SubField(Lable, 'cust_', 2)) as Customer_Rob,

  If(WildMatch(Lable, '*cust_*'), Left(SubField(Lable, 'cust_', 2), 3)) as Customer_Sunny;

LOAD * Inline [

Lable

03/02/2016 dfdfd, dgfidgfid, cust_abc

03/02/2016 dfdfd, dgfidgfid, cust_art, gdeugd

] (delimiter is |);

Capture.PNG

swuehl
MVP
MVP

Or like this, with a customizables stop character:

Let vStop = chr(39)&','&chr(39); //comma denotes break

//Let vStop = Chr(39)&chr(39); //digest to the end of label

Table:

LOAD Lable,

  TextBetween(Lable & $(vStop),'cust_',$(vStop)) as Customer_Stefan,

  If(WildMatch(Lable, '*cust_*'), SubField(Lable, 'cust_', 2)) as Customer_Rob,

  If(WildMatch(Lable, '*cust_*'), Left(SubField(Lable, 'cust_', 2), 3)) as Customer_Sunny;

LOAD * Inline [

Lable

03/02/2016 dfdfd, dgfidgfid, cust_abc

03/02/2016 dfdfd, dgfidgfid, cust_art, gdeugd

03/02/2016 dfdfd, dgfidgfid, nocust

] (delimiter is |);