Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
cancel
Showing results for 
Search instead for 
Did you mean: 
l_vilardi
Contributor
Contributor

How to take a substring of a string?

Hi guys,

i want to obtain a substring (last part) of a string, because i've a path conteining a file name and i have to retrieve only the file name.

The work case is the following:

PATH: C:\Users\thom.yorke\Desktop\Samples\file1.doc

PATH FOLDER: C:\Users\thom.yorke\Desktop\Samples\

NAME TO RETRIEVE: file1

Is there a method to subtract PATH FOLDER to string PATH?

1 Solution

Accepted Solutions
marcus_sommer
MVP & Luminary
MVP & Luminary

You could use:

subfield('C:\Users\thom.yorke\Desktop\Samples\file1.doc', '\', -1) to get the filename with extension and another subfield() could also split them like:

subfield(subfield('C:\Users\thom.yorke\Desktop\Samples\file1.doc', '\', -1), '.', 1)

If it should happens within a load you could also use filebasename().

- Marcus

View solution in original post

2 Replies
marcus_sommer
MVP & Luminary
MVP & Luminary

You could use:

subfield('C:\Users\thom.yorke\Desktop\Samples\file1.doc', '\', -1) to get the filename with extension and another subfield() could also split them like:

subfield(subfield('C:\Users\thom.yorke\Desktop\Samples\file1.doc', '\', -1), '.', 1)

If it should happens within a load you could also use filebasename().

- Marcus

View solution in original post

l_vilardi
Contributor
Contributor
Author

Ok, it works fine!

Thank You a lot