Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

In Between text

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

I applied the logic TExtBEtween(name,'(',')') and i worked for just one scenario

Can anyone help me out.

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



1 Solution

Accepted Solutions
Highlighted
Specialist II
Specialist II

Re: In Between text

Try - KeepChar(name, '0123456789')

View solution in original post

6 Replies
Highlighted
Specialist II
Specialist II

Re: In Between text

Try - KeepChar(name, '0123456789')

View solution in original post

Highlighted
Contributor II
Contributor II

Re: In Between text

Hi Neelam. I got the output but sorry i forgot to write another scenario

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


I have 3 scenarios and can you suggest what to do in this scenario??



Highlighted
Specialist II
Specialist II

Re: In Between text

So do you want the text/number between the last parenthesis??

Highlighted
Contributor II
Contributor II

Re: In Between text

Yeah.   alb - ik me "   is the name and if there is any number in the  parenthesis (1234) it should display the number or else " pittsburgh  ".


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

name                                                            XXX

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

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

    alb - ik me (1234)                                      1234

    alb - ik me (1234)                                      1234

    alb - ik me (pittsburgh)                           pittsburgh

Highlighted
Contributor III
Contributor III

Re: In Between text

Hi Harsha Vardhan   Kindly use the below code  it will meet your desired output

data:

load * Inline [

id      ,   state      ,   name                                                 

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

abc    ,    BC     ,  alb - ik me (abc def)(12345)                    

abc     ,   BC    ,   alb - ik me (12346)                                    

abc      ,   BC   ,   alb - ik me (1234)

abc      ,   BC   , alb - ik me (pittsburgh)    ];

load   

id,

state,

name ,

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

'*' as temp  Resident   data ;

drop table   data;




Thanks and Regards

Santhana Kumar

Highlighted
Contributor III
Contributor III

Re: In Between text

Hi use this


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