Formatting Patterns for Dynamic Names and Parameters

A formatting string is a sequence of characters enclosed in curly braces {}. Within a formatting string, some characters have special meanings, as described in the tables below. Any character not listed is copied unmodified to the final name.

Formatting strings can be used in output file/folder names (the -exportfile value) and with parameter values.

Note that you must include the "-useparametertokens" option on the command line or tokens in parameters will be ignored.

Date/Time Patterns

The following patterns are used to insert portions of the current date and/or time.

Format Pattern

Description

d

The day of the month. Single-digit days will not have a leading zero.

dd

The day of the month. Single-digit days will have a leading zero.

ddd

The abbreviated name of the day of the week.

dddd

The full name of the day of the week.

M

The numeric month. Single-digit months will not have a leading zero.

MM

The numeric month. Single-digit months will have a leading zero.

MMM

The abbreviated name of the month.

MMMM

The full name of the month.

y

The year without the century. If the year without the century is less than 10, the year is displayed with no leading zero.

yy

The year without the century. If the year without the century is less than 10, the year is displayed with a leading zero.

yyyy

The year in four digits, including the century.

gg

The period or era. This pattern is ignored if the date to be formatted does not have an associated period or era string.

h

The hour in a 12-hour clock. Single-digit hours will not have a leading zero.

hh

The hour in a 12-hour clock. Single-digit hours will have a leading zero.

H

The hour in a 24-hour clock. Single-digit hours will not have a leading zero.

HH

The hour in a 24-hour clock. Single-digit hours will have a leading zero.

m

The minute. Single-digit minutes will not have a leading zero.

mm

The minute. Single-digit minutes will have a leading zero.

s

The second. Single-digit seconds will not have a leading zero.

ss

The second. Single-digit seconds will have a leading zero.

f

The fraction of a second in single-digit precision. The remaining digits are truncated.

ff

The fraction of a second in double-digit precision. The remaining digits are truncated.

fff

The fraction of a second in three-digit precision. The remaining digits are truncated.

ffff

The fraction of a second in four-digit precision. The remaining digits are truncated.

fffff

The fraction of a second in five-digit precision. The remaining digits are truncated.

ffffff

The fraction of a second in six-digit precision. The remaining digits are truncated.

fffffff

The fraction of a second in seven-digit precision. The remaining digits are truncated.

t

The first character in the AM/PM designator.

tt

The AM/PM designator.

z

The time zone offset ("+" or "-" followed by the hour only). Single-digit hours will not have a leading zero. For example, Pacific Standard Time is "-8".

zz

The time zone offset ("+" or "-" followed by the hour only). Single-digit hours will have a leading zero. For example, Pacific Standard Time is "-08".

zzz

The full time zone offset ("+" or "-" followed by the hour and minutes). Single-digit hours and minutes will have leading zeros. For example, Pacific Standard Time is "-08:00".

:

The default time separator defined for the locale.

/

The default date separator defined for the locale.

Date/Time Offsets

The date/time patterns above by default use the current date/time at the time the report is run. It is also possible to use an earlier or later date instead. For example, suppose you run a report each day, but send yesterday's date to the report.

To send today's date, you would use this:

-parameters "{MM/dd/yyyy}"

Using an offset, you can send yesterday's date instead:

-useparametertokens -parameters "{-1d:MM/dd/yyyy}"

Notice that we have added "-1d:" to the beginning of the date token. This tells Report Commander to subtract one day from the current date and use the resulting date/time value instead of the current date/time. If the report is run on September 15, 2011, this is equivalent to the following option:

-parameters "09/14/2011"

Now suppose you have a report that you run on the first day of each month but want the data to be pulled from the previous month.

The following command-line options will accomplish this:

-useparametertokens -parameters "{-1m:MM/01/yyyy} 12:00:00 AM~!{MM/01/yyyy} 12:00:00 AM"

Notice that we have added "-1m:" to the beginning of the first date token. This tells Report Commander to subtract one month from the current date and use the resulting date/time value for the current token. The second token is unaffected.

If we were running this report on August 1, 2011, this would be equivalent to the following options:

-parameters "07/01/2011 12:00:00 AM~!08/01/2011 12:00:00 AM"

That is, the report will select all data with a date on or after July 1, but before August 1.

The date/time offset always must include these components:

For example:

Sequence Numbers

Report Commander can sequentially number output folders or files to prevent duplicates.

For example, you have a report that is exported several times during the day. You want to keep each version of the report in the same directory, and number them sequentially. You could use the following file name format:

exportfile=c:\reportoutput\{yyyyMMdd}\MyReport-{qqq}.pdf

Each time the report is exported, the sequence number will be incremented, resulting in the following files (assuming the report is run three times on the same day):

c:\reportoutput\20041203\MyReport-001.pdf
c:\reportoutput\20041203\MyReport-002.pdf
c:\reportoutput\20041203\MyReport-003.pdf

A sequence pattern can appear in either the path or the file name. However, it can only appear once in the full path/filename. For example, the following would be invalid:

exportfile=c:\reportoutput\{yyyyMMdd}{qqq}\MyReport-{qqq}.pdf

Sequence numbers cannot be used if the export file is to be uploaded using HTTP or FTP.

Format Pattern

Description

q
qq
qqq
etc.

The sequence number. The number of qs tells Report Commander how many digits it should pad the sequence number to. For example, q yields the sequence 1, 2, 3, ...; qq yields the sequence 01, 02, 03, ...; etc.