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: 
Not applicable

get a part of a string

Hello all,

In my qlikview document I load a couple of document locations. The problem is that i only want to load the document name and not the entire path. The problem is that the path to the documents isn't always the same length. For example:

What I loadWhat I need
C:\Documents\document1.qvwdocument1.qvw
C:\Documents\Customer1\Document3.qvwDocument3.qvw
C:\Documents\Customer 3\Document 2.qvwDocument 2.qvw

Does anybody know a solution for this problem?

Thanks a lot for your help!

1 Solution

Accepted Solutions
marcus_malinow
Partner - Specialist III
Partner - Specialist III

or subfield([Source field], '\', -1) as [Destination field]

View solution in original post

9 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

subfield([Source field], '\', substringcount([Source field], '\') + 1) as [Destination field]

marcus_malinow
Partner - Specialist III
Partner - Specialist III

or subfield([Source field], '\', -1) as [Destination field]

Not applicable
Author

Hello,

Could you use right(DocumentName(),13)??

Regards.

tresesco
MVP
MVP

Subfield(YourPath, '\', -1)

Or,

You might check if file functions like:

Filename() could help you.

rubenmarin

or

SubField[FieldName], '\', -1)

Subfield splits a string base don a specified separator, the parameters:

1st: the string

2nd: the separator

3rd: wich splited part you want to retrieve, negative numbers counts starting by the last

miguelbraga
Partner - Specialist III
Partner - Specialist III

Hi mate,

I've done what you need by using this expression:

=SubField(LOAD, '\', substringcount(LOAD, '\')+1)

Here take a look at my qvw

Regards,

MB

Not applicable
Author

Thank you very much! This was exactly what I need!

gsbeaton
Luminary Alumni
Luminary Alumni

You can use the subfield() function like this:

  SubField('C:\Documents\Customer 3\Document 2.qvw','\',-1)

The second parameter allows you to break the string down, in your case by the backslash and passing the -1 parameter at the end of the function will ensure you only ever pick up the final part of the string.

MarcoWedel

Hi,

maybe also helpful:

QlikCommunity_Thread_189604_Pic1.JPG

tabFileNames:

First 1

LOAD FileName() as FileName, [@1:1] as Temp

FROM QlikCommunity_Thread_189*.qvw (fix, codepage is 1252);

DROP Field Temp;

regards

Marco