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

TextBetween

I need to create a column XXX where i should get the Number/text  between the text.

KeepChar(name, '0123456789')  worked for 2 scenarios and i need to apply for the other one too.

id         state         name                                                  XXX

abc        BC       alb - ik me (abc def)(1234)                      1234

abc        BC       alb - ik me (abc def)(1234)                      1234

abc        BC       alb - ik me (1234)                                     1234

abc         BC      alb - ik me (1234)                                      1234

abc       BC       alb - ik me (pittsburgh)                           pittsburgh



Please help me out

1 Solution

Accepted Solutions
neelamsaroha157
Specialist II
Specialist II

check this -

Replace(mid(name, (Index(Trim(name), '(', -1)+1), (Index(trim(name), ')', -1)-1)), ')','')

View solution in original post

4 Replies
santhana
Contributor III
Contributor III

hi harsha vardhan use this

purgechar(subfield(name,'(',-1),')') as XXXX,

neelamsaroha157
Specialist II
Specialist II

check this -

Replace(mid(name, (Index(Trim(name), '(', -1)+1), (Index(trim(name), ')', -1)-1)), ')','')

vardhan1305
Contributor II
Contributor II
Author

Thanks Neelam. The logic  worked

swuehl
MVP
MVP

Since you called your post TextBetween, there is indeed a QV function TextBetween(), so another option could be

TextBetween(name, '(',')',SubStringCount(name,'(')) as newfield