Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a column called lables,
In that column there are several words
ex - lable1,deydfey,rfr,lable2
fgrfgr,rgrtt,lable1
here i need to find if 'lable1' exsist in each raw and store the value lable1 in separate column name lable1 when loading the script
LOAD
if(substringcount(MyString, 'lable1')>0, 'lable1') as MyField,
...other fields
FROM
...mysource
;
LOAD
if(substringcount(MyString, 'lable1')>0, 'lable1') as MyField,
...other fields
FROM
...mysource
;
This should also work, right Gysbert?
If(Index(MyString, 'lable1') > 0, 'lable1') as MyField
what happen if i want to find lable* in that string and store lable* value under the column lable
May be this:
If(WildMatch(MyString, 'Lable*'), 'lable' & Left(SubField(MyString, 'Lable', 2), 1)) as MyNewField
Assuming all text strings are comma separated lists you can do something like this:
LOAD
MySubstring as MyField,
...other fields...
WHERE Left(MySubstring, 5) = 'lable';
LOAD
subfield(MyString, ',') as MySubString,
...other fields...
FROM
...
Can you share a sample please
This works but problem is in my column lable we can predict number of characters,
ex - Lable_1
Lable_100
Lable_5454
So we can't have
'lable' & Left(SubField(MyString, 'Lable', 2), 1)