Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
try
If(WildMatch(lower(Lable), 'cust_*'), SubField(Lable, '_', 2),'aaa') as Customer
or
if( lower(Lable) like 'cust_*', SubField(Lable, '_', 2),'aaa') as Customer
If(WildMatch(Lable, '*cust_*'), SubField(Lable, 'cust_', 2)) as Customer
-Rob
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 |);
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 |);