06-19-2018 04:18 AM
Hi everyone,
I have a very simple automation chain in witch I extract the filemane to insert into a document title.
In a fist time, I declare a variable "varNomFichier" whith value @{Document.getProperty("file:filename")}, and in a second time, I execute a Document.SetProperty, with xpath dc:title and value @{Context["varNomFichier"]}.
The trouble is, my title take the name of the entire file name, with the file extension.
Can you tell me how to use a substring like expression to delete the ".extension" to keep only the file name ?
Thank you.
11-28-2018 05:50 PM
I think the easiest way will be to use an automation script as you can use substring in javascript
12-04-2018 11:26 AM
If you prefer to stay in "regular" automation (not using Automation Script) you probably can still use some java utils that are loaded by Nuxeo, like Apache FilenameUtils:
Context.FetchDocument
Context.SetVar:
name: blobFileName
value: @{Document["file:content"].filename}
Document.SetProperty:
xpath: dc:title
save: true
value: @{org.apache.commons.io.FilenameUtils.removeExtension(blobFileName)}
Notice you also can also just write:
Context.FetchDocument
Document.SetProperty:
xpath: dc:title
save: true
value: @{org.apache.commons.io.FilenameUtils.removeExtension(Document["file:content"].filename)}
06-19-2019 09:08 AM
A great tank you for your answers, it works !! (using, @{org.apache.commons.io.FilenameUtils.removeExtension(Document["file:content"].filename)}
😄
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.