Skip to main content


 

Symptoms


Inline Function file name modification returning incorrect/varied results with differing file extension length and period (.) characters.
 

Diagnoses


The solution in place was stripping out 3-4 characters from the right of the full file name and saving to a Data Field as the file extension. This would also sometimes grab the period characters on the end, and would truncate files with multiple periods (i.e. "Document Name 2.1.2016.pdf").
 

Resolution

Below is a solution using the LastItem() function from the Lists category, and Split(), Length(), and Left() from the Text category.

Data Event 1:
extension = LastItem( Split( tfilename], . ))

Data Event 2:
newFilename = Left( tfilename], Expression: Length( hfilename] ) - Length( hextension] ) - 1 )0123456789.8extension]


In English:
Data Event 1 splits the file name into multiple strings based on the period character as a delimiter, and then sets textension] to the last string (which is your extension without the preceding period).

Data Event 2 takes the left side of the file name minus the length of extension (and it's preceding period) and then concatenates it with your random number (denoted by '0123456789'), a period, and the extension.

This has been tested this using the web designer and it successfully renames documents that have many periods and/or long extension names (like page.master).




 
Be the first to reply!

Reply