Dynamic Delivery File Naming
By Tim Dexter on Dec 03, 2009
Three folks have asked me about this just today. They wanted to create file names for FTP, Email or WebDAV that have some dynamic component to them e.g. TIM1212009.pdf where the numeric values relate to the date.
Well I learned something today, its supported on the standalone server. Its not that Leslie had not documented it; its just, its tucked away in the API documentation.
You can use the date expressions for a couple of properties. Those expressions will be translated with the actual values just before the delivery. Available expression are following.
- %y : 4 digit year (ex, 1972, 2005)
- %m : 2 digit month (00 - 12)
- %d : 2 digit date (00 - 31)
- %H : 24h based 2 digit hour (00 - 24)
- %M : 2 digit minute (00 - 59)
- %S : 2 digit sec (00 - 59)
- %l : 3 digit millisec (000 - 999)
For example, if you specify my_file_%y%m%d.txt for the filename, the actual filename will be 'my_file_20051108.txt'.
During some testing we have found that the following statement is not quite true. If you use unsupported expressions such as %a%b%b.pdf you file will arrive on the destination server as defined ie %a%b%b.pdf.
All undefined expressions will be translated into 0 length string, for example, if you specify my_file_%a%b%c.txt, it will be my_file_.txt. You can escape the '%' letter by passing '%%'.
The properties that support the date expressions are as follows.
- E Mail file attachment
- FTP Filename
- WebDAV filename
This can be set either in the standalone scheduling page or when using the delivery APIs.