Shorten filename but retain extension for string variable

Avatar

Avatar
Validate 1
Level 2
berlink0304
Level 2

Likes

3 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
berlink0304
Level 2

Likes

3 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
berlink0304
Level 2

29-01-2018

Hello,

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?

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

29-01-2018

Are your working with Adaptive Forms, Adobe Document Services, are you using a custom process? Please provide more information on the products you are using?

Avatar

Avatar
Validate 1
Level 2
berlink0304
Level 2

Likes

3 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
berlink0304
Level 2

Likes

3 likes

Total Posts

5 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
View profile
berlink0304
Level 2

29-01-2018

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.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

29-01-2018

You can build a custom process step (using Java) to manipulate the name to fit your needs.