Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
sanjujeeboy
Creator
Creator

extract string

i have 2 field values

sales_mrtyf_qtr_09_2017

under_qtr_03_2015

i want to extract the string 'qtr'  from both values. how to achieve that?

1 Solution

Accepted Solutions
sunilkumarqv
Specialist II
Specialist II

This will work for

if(WildMatch(YourField,'*qtr*'),'Qtr')

View solution in original post

12 Replies
tresesco
MVP
MVP

It's 3rd subfield (delimited by '_') from end.

try like:

=SubField(YourField,'_', - 3 )

sanjujeeboy
Creator
Creator
Author

the end is not specific....after 2017 there can be values like 2017_abc etc..

shwethaa
Contributor III
Contributor III

Try this-

=mid('sales_mrtyf_qtr_09_2017',index('sales_mrtyf_qtr_09_2017','qtr',1),3)

Mid(text,index(text,searchstring,1),3)

arvind1494
Specialist
Specialist

Try this

left(Right('sales_mrtyf_qtr_09_2017',11),3)

left(Right('under_qtr_03_2015',11),3)

sunilkumarqv
Specialist II
Specialist II

This will work for

if(WildMatch(YourField,'*qtr*'),'Qtr')

shwethaa
Contributor III
Contributor III

I don't think this solution will work because we can't predict that qtr will be in same position. So it is not flexible with different data right?

raman_rastogi
Partner - Creator III
Partner - Creator III

Hi Jeeyboy

try this

replace(PurgeChar ( Replace('sales_mrtyf_qtr_09_2017','_qtr_','$'),

'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'),'$','_qtr_')

Regards

Raman Rastogi

vishsaggi
Champion III
Champion III

Try this?

= Mid(TextFieldnamehere, Index(YourTextFieldnamehere, 'qtr'), 3)

sanjujeeboy
Creator
Creator
Author

yes you are right.....the wildmatch solution given above is working fine.....