Appendix 5: Dynamic names

When you run a report periodically, and if you publish the report result with a fixed name, then only the last generated report result can be kept on disk. In order to save the result generated every time, a dynamic result file name must be used. Similarly, you can use a dynamic directory path to avoid report management difficulties, since when a fixed directory path is specified, too many results may be generated in a single directory. JReport Server provides you with the following defined strings to form a dynamic name:

By Strings Defined Description (Sample)
Time Forms the file name using the date/time when the result is generated (e.g. 2006-07-25, 00:00:00 AM).
yyyy Returns the year (e.g. 2006).
yy Returns the year in short form (e.g. 06).
MM Returns the month of the year, shown in number format (e.g. 12).
dd Returns the day of the month, (e.g. 25).
hh Returns the hour of the day (e.g. 05). It is used for the 12-hour time.
HH Returns the hour of the day (e.g. 05). It is used for the 24-hour time.
mm Returns the minute of the hour (e.g. 00).
ss Returns the second of the minute (e.g. 00).
m Returns the AM/PM marker (e.g. AM).
User Forms the file name using user name.
name Returns the name of the user who is currently logged onto the computer (e.g. Mike).
z Returns the ordinal number (e.g. 001.pdf, 002.pdf, 003.pdf).
System Forms the file name using the system variables.
language Returns local computer configuration language (e.g. en).
zone Returns the system configuration time zone (e.g. GMT-05.00).
encoding Returns the file encoding (e.g. Cp1252).
region Returns the system configuration region (e.g. US).
JReport
pathcat Returns the catalog file name, with its path and extension (e.g. path.SampleReports.cat).
CAT Returns the catalog file name, with its extension (e.g. SampleReports.cat).
cat Returns the catalog file name, without its path and extension (e.g. SampleReports).
pathcls Returns the report file name, with its full path (e.g. catalog path and report path) and extension (e.g. path1.path2.CustomerAnalysis.cls).
CLS Returns the report file name, with its extension (e.g. CustomerAnalysis.cls).
cls Returns the report file name, without its extension and path (e.g. CustomerAnalysis).
sheet Returns the report tab name in the report (e.g. report1). However for formats such as .rst, .rsd, and .wst, the string "[sheet]" will be interpreted literally as "[sheet]" itself.

Naming Rules

Notes:

Here are some examples of the dynamic result file name:

The Sample Name The Sample Result File Name
myTXTResult_[yyyy].[MM].[dd].[hh].[mm].[ss].txt myTXTResult_2003.10.30.05.14.45.txt
myPDFResult_CT[zone][language][region]my$$[1].pdf myPDFResult_CTGMT-05.00enUSmy$[1].pdf
myRSTResult_[pathcat][CLS].rst myRSTResult_SampleReports.SampleReports.catCustomerAnalysis.cls.rst
myRSTResult_[zzz].rst myRSTResult_001.rst, myRSTResult_002.rst, ...
myHTMLResult[cat]_[cls]_[zz].html myHTMLResultSampleReports_CustomerAnalysis_01.html, myHTMLResultSampleReports_CustomerAnalysis_02.html,...
myHTMLResult_[yy]$[YYYY][MM]M[dd]D$name$cls[cls].html myHTMLResult_02[YYYY]06M21D$name$clsCustomerAnalysis.html