Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
remo0017
Contributor II
Contributor II

SubField issue on Qlikview

Hi Everyone,

I have a situation where I need to pull only 4 characters [ZZZZ] before @ symbol in the email formats shown below

Tom.x.harry.peter.ZZZZ@gmail.com

Tom.x.harry.ZZZZ@gmail.com

Tom.x.ZZZZ@gmail.com

Tom.x.harry.peter.o.ZZZZ@gmail.com

I tried below but it works for only one situation

subField(SubField(upper(Column1),'.',3),'@'.1)

Looking forward for the lead

Thanks very much.

1 Solution

Accepted Solutions
sunny_talwar

Both suggestions seems to be working

Table:

LOAD *,

  SubField(SubField(Email, '@', 1), '.', -1) as NewField,

  Mid(Email, Index(Email, '@')-4,4) as NewField2;

LOAD * INLINE [

  Email

    Tom.x.harry.peter.ZZZZ@gmail.com

    Tom.x.harry.ZZZZ@gmail.com

    Tom.x.ZZZZ@gmail.com

    Tom.x.harry.peter.o.ZZZZ@gmail.com

];

The one in Red is proposed by Anil and the one in Blue is by Neelam.

Capture.PNG

View solution in original post

6 Replies
neelamsaroha157
Specialist II
Specialist II

How about this:

=Mid(Mail, Index(Mail, '@')-4,4)

remo0017
Contributor II
Contributor II
Author

Nopes that doesn't work   I tried it

Thanks very much for the above suggestion Neelam

Anil_Babu_Samineni

How about this?

=SubField(SubField(FieldName,'@', 1),'.',-1)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Both suggestions seems to be working

Table:

LOAD *,

  SubField(SubField(Email, '@', 1), '.', -1) as NewField,

  Mid(Email, Index(Email, '@')-4,4) as NewField2;

LOAD * INLINE [

  Email

    Tom.x.harry.peter.ZZZZ@gmail.com

    Tom.x.harry.ZZZZ@gmail.com

    Tom.x.ZZZZ@gmail.com

    Tom.x.harry.peter.o.ZZZZ@gmail.com

];

The one in Red is proposed by Anil and the one in Blue is by Neelam.

Capture.PNG

remo0017
Contributor II
Contributor II
Author

These work Guys, thanks very much for your help

Much appreciated Anil, Sunny and Neelam

sunny_talwar

Please mark Neelam/Anil's response as correct because I simply took there expressions and create a script for you. or at least mark there responses as helpful as they put in the effort to come up with the correct response and as I just showed, both the responses seems to be working.

Thank you,

Sunny