Currently we are storing the filename of an attachment a user uploads into a variable (@strFileNm). We then use that variable to build a URL to find the file in another location. Once the file is found, it is stored in another variable (@docFile).
Later on, we use the filename variable to provide the filename to another application we interface with. The problem I'm having is that application can only accept a string of 30 characters.
I need to be able to have the file name unchanged for when we are building the URL in the above steps. After the file is retrieved and stored in the other variable, I need to change the value of the filename variable to a shortened value so it can go to our other application.
I need the file to retain the extension however. These are .pdf files. I'm trying to figure out how to shorten a filename if it's longer than 30 characters, but leave .pdf
Does this need to be done by nesting substrings in the Xpath expression? substring-before(@strFileNm, '.pdf') would get the string before the extension, but if I cut down that string, will it later have the .pdf again at the end? Or am I losing .pdf period with that method?
I'm working with AEM 6.1 adaptive forms. The OOTB attachment page is being used, and we hold that filename in our XML. Eventually we take that xml value and give it to the strFileNm variable that we then use for a few steps in other processes we've built where we store and retrieve files from our server.