Command-Line Syntax

Report Commander is run from a command prompt or an automation tool such as a batch file or scheduler.

The command-line builder can be used to generate the required command line for a report. New users may wish to use this tool initially as they learn the command-line syntax.

Syntax

adcrutil -help

Displays a usage summary

adcrutil -builder

Displays the command-line builder

adcrutil -report=reportfilename [-option[=value] [-option[=value] [...]]] [-parameters parameter1 [parameter2 [...]]]

Loads the specified report and acts on it according to the options specified, as described below.

Options

The following table describes the command-line options used to execute Report Commander. Additional options are available for some export formats; follow the link provided for the export format to view the additional options.

Report Source Options

 

-report=reportfilename

Provide the complete path and name of the report file.

Download Report

Report Commander can download the source report file using HTTP or ftp using the following syntax

-report=http://myserver/reports/myreport.rpt
-report=http://userid:password@myserver/reports/myreport.rpt
-report=http://domain\userid:password@myserver/reports/myreport.rpt

-report=ftp://myserver/reports/myreport.rpt
-report=ftp://userid:password@myserver/reports/myreport.rpt
-report=ftp://domain\userid:password@myserver/reports/myreport.rpt

If the server requires authentication, include the user ID and password as part of the URL, as shown above.

If the Web server uses Windows (integrated) authentication, Report Commander will automatically authenticate using the credentials of the user running the program, if credentials are not included as part of the URL.

-refresh

Specifies that the report should be refreshed after it is loaded (equivalent to pressing F5 in the Crystal Reports viewer). If your report has the Save data with report option checked in Crystal Reports, use this command to force Report Commander to refresh the data (otherwise the saved data will be used). This command is unnecessary if the Save data with report option is not checked for your report.

-suppressempty

Specifies that processing should terminate if the report does not contain any data. When this option is included, Report Commander will not print, export, or e-mail your report if the data source does not return any records.

Printing Options

 

-print

Specifies that the report should be printed. If no printer is specified using the printer option, the report is sent to the default printer for user account under which the program is run.

-printer="printer name"

Use with the print command to print to a printer other than the default. For example:

-print -printer="my printer"

-preview

Opens the report in a preview window instead of printing it.

-copies=numcopies

Specifies the number of copies to print. If omitted, one copy is printed.

Connection Options

Additional options for connections and credentials

-login=userID:password

If database login credentials are required, use the login option to provide them.

If the report uses more than one database connection, provide the credentials for each, in the proper order. For example:

-login=userid1:password1 -login=userid2:password2

If a connection does not require a user ID and password, use "-login=", with no credentials. For example:

-login=userid1:password1 -login= -login=userid3:password3

(The second connection does not require credentials)

-login!=userID:password

This option is identical to login, except that password is an encrypted password (generated using the encrypt option).

For example, you are using Report Commander from a batch file, and do not want people to be able to see your database login password. Assuming your password is "mypassword", you would first run:

adcrutil -encrypt=mypassword

This would return an encrypted value of

5vFHQI+NNBsoaZqzG9eJTA==

You would then use the login! option in your batch file:

adcrutil -login!=myuserid:5vFHQI+NNBsoaZqzG9eJTA== ...

-encrypt=password

Encrypts a password for later use with the login! option.

Export Options

 

-exportfile="file name"

If you wish to export the file or e-mail it, specify the name of the file, including the path and extension.

Upload Output

The output file(s) can be uploaded to a remote server using HTTP or FTP. More information.

-exportformat=format

Specify the format to which the report should be exported. Additional formatting options are available for some export formats. Follow the "More Information" link for an export format to view these additional options.

Valid values for format are:

csv

CSV (Comma-Separated Values). More information on CSV exports

html

HTML 4.0. More information on HTML exports

html32

HTML 3.2. Provides backward compatibility with older browsers and e-mail clients that do not support DHTML. More information on HTML exports

msword

Microsoft Word. More information on Word exports

editablertf

Microsoft Word/RTF - Editable. More information on editable RTF exports

pdf

Adobe Portable Document Format ("Acrobat"). More information on PDF exports

rpt

Crystal Report format. Similar to using the "Save Data with Report" option in the Crystal Reports designer

rtf

Rich Text Format. More information on RTF exports

text

Text. More information on text exports

xls

Microsoft Excel Spreadsheet. More information on Excel exports

xlsrecord

Microsoft Excel Spreadsheet (Data Only). More information on Excel Data-Only exports

xml

XML format. More information on XML exports

-removefile

Specifies that the export file should be deleted when the program finishes. Use this option if you want to e-mail the report, but don't want to retain the file afterwards. If removefile is omitted, the file remains.

-uploadmethod

This option is used when uploading the export file. More information.

-uploadtarget

This option is used when uploading the export file. More information.

E-Mail Options

 

-emserver=serveraddress[:port]

Specify the name or address and optionally the port for the SMTP server through which the message will be sent.

-emsender=emailaddress

Specify the e-mail address from which the message will be sent.

-emrecipient=emailaddress

Specify the e-mail address to which the message will be sent. Multiple recipients can be specified by using multiple emrecipient parameters. For example:

[email protected] [email protected]

 

-emsubject="message subject"

Specify the subject of the e-mail message. If emsubject is omitted, a default subject will be used.

-emtext="message text"

Specify the text of the e-mail message. If emtext is omitted, a default message will be used.

To load the message body from a file, use

-emtext="@bodyfilename"

If the file contains an HTML document, the message will be formatted as an HTML message. Otherwise it will be formatted as a plain text message.

You set the body of the e-mail message to be the HTML output from the report by setting the emtext to the export file name. More information.

-emuserid=userid

The user ID for your e-mail account, if the SMTP server requires authentication for sending mail

-empassword=password

The password for your e-mail account, if the SMTP server requires authentication for sending mail

-empassword!=password

This option is identical to the -password option, except that password is an encrypted password (generated using the encrypt option).

-emusetls

Use TLS for a secure connection to the mail server. Do not use this option unless your mail server is configured for TLS, or the e-mail send will fail.

-emreceipt

Requests a read receipt for any e-mail messages sent by Report Commander

-attachfile="filename"

Attach additional files to the e-mail message when e-mailing the report output. For example, you may want to attach an HTML page with a standard report key or overview. Attach multiple files by using multiple attachfile parameters. For example:

-attachfile="c:\files\note1.htm" -attachfile="c:\files\note2.htm"

Miscellaneous Options

 

-logfile="filename"

Causes Report Commander to write all progress and error messages to the specified log file, in addition to writing them to the console.

-appendlog

If set, output is appended to the existing log file (if it exists). Otherwise the log is overwritten each time Report Commander runs.

-verbose

Causes Report Commander to display additional information as it processes the report, which may be useful in diagnosing problems.

Parameters

 

-parameters

Follow with any parameters required by the report. The parameters option must come after all other options, and be followed by the parameters, in the order they are expected by the report.

Parameters that contain spaces or punctuation must be enclosed in quotation marks.

Multiple Values

For parameters that accept more than one value, use the following syntax:

-parameters "value1,value2,value3"

Note that parameters containing a quotation mark or comma are not supported.

Ranges

For parameters that accept a range of values, use the tilde (~) to separate the beginning and ending values. For example:

-parameters 3.5~26

You may omit the starting and ending value if appropriate:

-parameters 20~

-parameters ~18

By default the starting and ending value will be included in the range. To exclude a value, prefix it with an exclamation (!). For example:

-parameters 1~!4

This would include all values in the range from 1 to 4, including 1 but not 4.

Example

Your report expects three parameters: A start date (date), end date (date) and the names of the regions to report on (multi-value string). The parameters would be specified on the command line as:

-parameters "12/1/2003" "12/31/2003" "Region A,Region B, Region C"

-namedparameters

Allows you to specify the parameters for the report by name. This option must be the last option on the command line, followed by the parameters in the form 'name=value'. This option cannot be used if the parameters option is used.

The syntax for specifying parameter values is the same as the syntax when using the parameters option.

When using the namedparameters option you can specify the parameters in any order, and omit optional parameters.

Example

Your report expects three parameters: "Start Date" (date), an optional "End Date" (date) and the "Regions" to report on (multi-value string). The parameters would be specified on the command line as:

-namedparameters "start date"="12/1/2003" "end date"="12/31/2003" region="Region A,Region B, Region C"

You could also omit the option end date and specify the parameters as:

-namedparameters "start date"="12/1/2003" region="Region A,Region B, Region C"

Note: If your parameter name starts with "@" (e.g., "@Parameter1" you must "escape" the name using the "\" character:

-namedparameters \@Parameter1=1234

 

-useparametertokens

Signifies that parameter values may contain formatting patterns, which can be used to automatically insert date and time values based on the current date when the report runs.

See Also

Examples | Exit Codes | Command-Line Builder | Response Files