Using Dynamic Report File Names

This topic explains how you can assign reports a dynamic file name, which changes each time the report is generated.

Overview

When you export a report to a file, you can insert data (“variables,” such as the current company and check date), so that some text is static and some is dynamic, into the Filename field of the Output tab.

This capability is particularly helpful when you send a report to a client via e-mail; the client can save the report without renaming it to prevent an earlier report from being overwritten.

You can use dynamic file names for Crystal reports, hard-coded reports, and ReportWriter (for Millennium® 3 or Payentry®) reports.

Dynamic Code Blocks

When you create a report and supply its file name, you can insert one or more dynamic code blocks that will automatically be changed when the report is generated. The format of a dynamic code block is:

[code(format)]

Variable Codes

The available variable codes are as follows:

  • RUNDATE — The date/time the report was run.
  • COMPANY.CO — The company code.
  • COMPANY.NAME — The company name.
  • COMPANY.STATE — The state the company is located in.
  • COMPANY.DBA — The company DBA name.
  • COMPANY.EIN — The company Federal EIN.
  • COMPANY.SBGROUPID — The ID of the service bureau associated with the company.
  • REPORT.CHECKDATESTART — The start date specified for the report data.
  • REPORT.CHECKDATEEND — The end date specified for the report data.
  • REPORT.SUBTITLE — The subtitle specified for the report.
  • REPORT.PROCESSSTART — The starting process specified for the report data.
  • REPORT.PROCESSEND — The ending process specified for the report data.
  • REPORT.RUNNINGCHECKDATE — The check date for reports run as part of processing.
  • REPORT.RUNNINGPROCESS — The process number for reports run as part of processing.

Format Codes

The format code is optional and can be omitted. If you omit it, do not enter the opening or closing parenthesis.

For all non-date variables, the format code is simply the number of characters you want to include. If you omit the format code or enter a 0 (zero), the system includes the first 100 characters of the item you are displaying.

For date variables (RUNDATE, REPORT.CHECKDATESTART, REPORT.CHECKDATEEND, and REPORT.RUNNINGCHECKDATE), the format code is a text string comprised of one or more of the following values (please note that capitalization counts):

  • %a – Abbreviated weekday name
  • %A – Full weekday name
  • %b – Abbreviated month name
  • %B – Full month name
  • %d – Day of month as decimal number (01–31)
  • %H – Hour in 24-hour format (00–23)
  • %I – Hour in 12-hour format (01–12)
  • %j – Day of year as decimal number (001–366)
  • %m – Month as decimal number (01–12)
  • %M – Minute as decimal number (00–59)
  • %p – Current locale’s A.M./P.M. indicator for 12-hour clock
  • %S – Second as decimal number (00–59)
  • %U – Week of year as decimal number, with Sunday as first day of week (00–53)
  • %w – Weekday as decimal number (0–6; Sunday is 0)
  • %W – Week of year as decimal number, with Monday as first day of week (00–53)
  • %y – Year without century, as decimal number (00–99)
  • %Y – Year with century, as decimal number

If you do not include the format code, the system uses %Y%m%d, which corresponds to the 4-digit year followed by a 2-digit month and a 2-digit day.

Examples

When you name files, you can mix the dynamic code blocks within other text.

For example, you are running a report for company ABC (ABC Company) on 9/1/2010. You enter the following file name:

Co_[COMPANY.CO]_File01_[REPORT.RUNNINGCHECKDATE(%Y_%m)].csv

When the system generates the report, it saves it using the following file name:

Co_ABC_File01_2010_09.csv 

For another example, you enter the following file name:

Co_[COMPANY.NAME(7)]_File02_[REPORT.RUNNINGCHECKDATE(%B)].txt

When the system generates the report, it saves it using the following file name:

Co_ABC Com_File02_September.txt