Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
RutiTaumanRubin
Creator
Creator

Extract specific word from string

Hi All,

I have field that include the following data:

 

Email T , Email B , TRY

TRY, Email T , Email C

Email T

Email C

 

I want to extract the first place with the word  the word "Email" till the next comma and just In case its not "Email T".

In my example I expect to get the following results:

Email T , Email B , TRY -- B

TRY, Email T , Email C -- C

Email T -- Null

Email C -- C

 

Thanks,

2 Replies
Taoufiq_Zarra

one solution :

Data:

load if(Tmp='Email T',Null(),Tmp) as Tmp2,rowno() as ID,*;
load subfield(Field,',') as Tmp,* inline [
Field
"Email T , Email B , TRY"

"TRY, Email T , Email C"

"Email T"

"Email C"
];

left join

load Field,FirstSortedValue(Tmp2,ID) as New_Field resident Data where len(Tmp2)>0 and wildmatch(Tmp2,'*Email*')>0 group by Field ;

output:
load distinct Field,Replace(New_Field,'Email','') as New_Field resident Data;

drop table Data;

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Saravanan_Desingh

One solution is.

tab1:
LOAD *, SubField(Word,' ',2) As Mailer
Where Word Like 'Email*' And Word <> 'Email T';
LOAD *, Trim(SubField(F1,',')) As Word;
LOAD RecNo() As RowID,* INLINE [
F1
Email T , Email B , TRY
TRY, Email T , Email C
Email T
Email C
](delimiter is '\t');

commQV56.PNG