Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
amit_saini
Honored Contributor III

Seprating numbers out of string help!!!

Hi Folks ,

I'm having below scenario:

Were these KT-PartNo belongs to Plant codes highlighted after # in location filed

What I want to have is output like below , so that I can assign Location codes for KT-PartNo:

Please suggest how to do this???

Thanks,

AS

1 Solution

Accepted Solutions
MindaugasBacius
Valued Contributor II

Re: Seprating numbers out of string help!!!

Use this:

SubField(right(KeepChar(Location, '#0123456789'), len(KeepChar(Location, '#0123456789'))-1), '#')

Result:

Screenshot_1.jpg

10 Replies
danansell42
Contributor III

Re: Seprating numbers out of string help!!!

Have you tried using the subfield function?

Re: Seprating numbers out of string help!!!

KeepChar(SubField(Location,'#'), '01234567989') as Location

or maybe

TextBetween(SubField(Location,'#'), '#',' KT') as Location


talk is cheap, supply exceeds demand
amit_saini
Honored Contributor III

Re: Seprating numbers out of string help!!!

Thanks Gysbert!

Buy why we are getting blanks:

Thanks,

AS

Not applicable

Re: Seprating numbers out of string help!!!

Re: Seprating numbers out of string help!!!

TextBetween(SubField(Mid(Location,Index(Location,'#')+1),'#'), '#',' KT') as Location


talk is cheap, supply exceeds demand
amit_saini
Honored Contributor III

Re: Seprating numbers out of string help!!!

Sorry this is not working!

KeepChar(SubField(Location,'#'), '01234567989') as Location is working but showing some blank values

Thanks,

AS

Not applicable

Re: Seprating numbers out of string help!!!

try my method Amit, i think it works in your case!

MindaugasBacius
Valued Contributor II

Re: Seprating numbers out of string help!!!

Use this:

SubField(right(KeepChar(Location, '#0123456789'), len(KeepChar(Location, '#0123456789'))-1), '#')

Result:

Screenshot_1.jpg

MindaugasBacius
Valued Contributor II

Re: Seprating numbers out of string help!!!

SubField takes values from the left.

If there is value like #001#002#003, then the first SubField value that will be returned is a blank value.

Community Browser