Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
anuradhaa
Partner - Creator II
Partner - Creator II

Extract Work from string

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

1 Solution

Accepted Solutions
Gysbert_Wassenaar

LOAD

     if(substringcount(MyString, 'lable1')>0, 'lable1') as MyField,

     ...other fields

FROM

     ...mysource

     ;


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Gysbert_Wassenaar

LOAD

     if(substringcount(MyString, 'lable1')>0, 'lable1') as MyField,

     ...other fields

FROM

     ...mysource

     ;


talk is cheap, supply exceeds demand
sunny_talwar

This should also work, right Gysbert?

If(Index(MyString, 'lable1') > 0, 'lable1') as MyField

anuradhaa
Partner - Creator II
Partner - Creator II
Author

what happen if i want to find lable* in that string and store lable* value under the column lable

sunny_talwar

May be this:

If(WildMatch(MyString, 'Lable*'), 'lable' & Left(SubField(MyString, 'Lable', 2), 1)) as MyNewField

Gysbert_Wassenaar

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

     ...


talk is cheap, supply exceeds demand
anuradhaa
Partner - Creator II
Partner - Creator II
Author

Can you share a sample please

anuradhaa
Partner - Creator II
Partner - Creator II
Author

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)