Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
khaycock
Creator
Creator

Removing characters from field

I want to use the filename of my datafile as a field however the filename is a URL as it's a webfile from SharePoint. Is there a way I can trim a field if the the result is currently like..?

/test.sp.test.com/sites/dept/it/Flat%2020File%20Repository/IT/test/Shapshots/2019-05%20Export.csv

Ideally all I want the field to show is 2019-05 but if its not possible to trim on from the right as well it doesn't matter, it just looks ugly with all the other bits in it!

Labels (1)
1 Solution

Accepted Solutions
Colin-Albert
Partner - Champion
Partner - Champion

You can do this using a couple of subfield() commands, to extract the text from the end of the field to the first '/', then from the start of the extracted text to the first %.

subfield(subfield(<yourfilepath>, '/', -1), '%', 1) as file_date

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/Strin...

View solution in original post

1 Reply
Colin-Albert
Partner - Champion
Partner - Champion

You can do this using a couple of subfield() commands, to extract the text from the end of the field to the first '/', then from the start of the extracted text to the first %.

subfield(subfield(<yourfilepath>, '/', -1), '%', 1) as file_date

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Scripting/Strin...