Command-Line Syntax

The Command Runner (adcrutil) does not use project files (use the Project Runner to execute project files). Instead, all processing is controlled through command-line options. If you don't want to work directly with command-line options, you can use the Command Line Builder to generate the command line for you.

Syntax

adcrutil -report=reportfilename [-option[=value] ...]

General requirements:

You can use a response file to supply parameter values. But if you are using response files extensively, you should consider using project files instead, with the Project Editor and Project Runner.

Options

General Report Options

These options tell Report Commander which report to load and provide general processing instructions.

Option Description
-report=reportfilename

Provide the complete path and name of the report file to process.

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 Designer). 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.

This option works by checking to see if the report contains detail records, regardless of whether they are displayed, and may not always produce the result you want. More information.

Database Connection Options

These options are used to specify database connection information.

Beginning with Report Commander 2.2, there is a new syntax for database logins, as described below. The Command Line Builder will create command lines using this syntax. However, the syntax used in previous versions of Report Commander will still work.

Option Description
-login=connection information

If database login credentials are required or you need to override the connection to point to a different data source, use the -login option to provide them.

If the report uses more than one database connection, provide the credentials for each, in the same order they occur in the report.

Each "login" parameter consists of one or more of the following sections:

{server:servername}
Specify the new server name or address
{database:dbname}
Specify the new database name
{schema:schemaname}
Specify the new schema name
{userid:userID}
Specify the user ID
{password:password}
Specify the unenecrypted password
{encryptedpassword:password}
Specify an encrypted password (generated using the -encrypt option)

All sections are optional. If the password or encryptedpassword section is used, it must come last. Do not leave a space between sections.

For example:

-login={userid:userid1}{password:password1} -login={userid:userid2}{password:password2}

Override the connection to use a different database on the same server:

-login={database:mynewdb}{userid:userid1}{password:password1} -login={userid:userid2}{password:password2}

If a connection does not require a user ID and password, or you want to use integrated security for the connection, use "-login=", with no credentials. For example:

-login={userid:userid1}{password:password1} -login= -login={userid:userid3}{password:password3}

(The second connection does not require credentials)

If you are using Report Commander from a batch file or other tool and do not want people to be able to see your database login password, you can encrypt the password for use on the command line. Assuming your password is "mypassword", you would first run:

adcrutil -encrypt=mypassword

This would return an encrypted value similar to

5vFHQI+NNBsoaZqzG9eJTA==

You would then use the encryptedpassword option in your batch file:

adcrutil -login={userid:myuserid}{encryptedpassword:5vFHQI+NNBsoaZqzG9eJTA==} ...

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

Printing Options

These options are used to print the report.

Option Description
-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="HP Laserjet 2000000"

This value can contain variables and functions that are replaced at runtime.

-preview Opens the report in a preview window instead of printing it. When this option is included, the report is not printed or exported, even if print or export options are specified.
-copies=numcopies Specifies the number of copies to print. If omitted, one copy is printed.
-printengine=engine Omit this option to use the default engine, which is correct for most scenarios. Specify a different engine only if you encounter a printing problem and the knowledge base indicates that you should use a different setting.

Export Options

These options are used to export the report to a file. The Command Runner can only export to one format at a time. To produce multiple exports, use the Project Runner instead.

Option Description
-exportfile="file name"

Export the report to the specified file name. Include the path for the file, or it will be exported to the current working directory.

If you are using the -removefile option to delete the file after it is e-mailed, you do not need to include the path, as the file will be exported to a temporary location.

The output file can be uploaded to remote server using HTTP, FTP, or SFTP. See the Uploading Output topic for more information.

This value can contain variables and functions that are replaced at runtime.

-exportformat=format

Specify the format to which the report should be exported. Additional formatting options are available for some export formats.

Valid values for format are:

csv
CSV (Comma-Separated Values). More options for CSV exports
html
HTML 4.0. More options for HTML exports
html32
HTML 3.2. Provides backward compatibility with older browsers and e-mail clients that do not support DHTML. More options for HTML exports
msword
Microsoft Word. More options for Word exports
pdf
Adobe Portable Document Format ("Acrobat"). More options for 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 options for RTF exports
editablertf
Microsoft Word/RTF - Editable. More options for editable RTF exports
text
Plain text. More options for text exports
xls
Microsoft Excel 97-2003 Spreadsheet. More options for Excel exports
xlsx
Microsoft Excel Spreadsheet (newer XLSX format). More options for Excel exports
xlsrecord
Microsoft Excel Spreadsheet (Data Only). More options for Excel Data-Only exports
xml
XML format. More options for 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 Server Options

These options tell Report Commander how to connect to an SMTP mail server to e-mail your report.

If you have defined shared e-mail server settings using the Command Line Builder or the Project Editor, you can omit these options and the shared settings will be used. However, be sure that the shared settings are copied over if you run Report Commander under a different user account or on a different computer.

Option Description
-emserver=serveraddress[:port] Specify the name or address and optionally the port for the SMTP server through which the message will be sent.
-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. Generally Report Commander will figure out on its own whether to use TLS, and this option is not necessary.

E-Mail Options

These options are used to send the exported report by e-mail. To e-mail a report you must also specify the necessary options to export it to the desired format.

When specifying an e-mail address, you can specify just the address, or you can optionally include the recipient's name, as shown in the following examples:

[email protected]

Some Person <[email protected]>

Option Description
-emsender=emailaddress

Specify the e-mail address (and, optionally, name) from which the message will be sent. If this option is omitted, the default sender specified in the shared e-mail settings will be used. If no default sender is present, Report Commander will issue an error and the e-mail message will not be sent.

This value can contain variables and functions that are replaced at runtime.

-emrecipient=emailaddress

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

[email protected] -emrecipient="Another Person <[email protected]>"

You can prefix a recipient with "TO:", "CC:", or "BCC:" to specify how the recipient should be added to the message. For example:

-emrecipient="TO:[email protected]" -emrecipient="CC:Another Person <[email protected]>" -emrecipient="BCC:Secret Recipient <[email protected]>"

To send the message to members of a distribution list, specify the name of the distribution list prefixed with "@":

-emrecipient="TO:@salesmanagers" -emrecipient="CC:@projectmanagers"

This value can contain variables and functions that are replaced at runtime.

-emsubject="message subject"

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

This value can contain variables and functions that are replaced at runtime.

-emtext="message text"

Specify the text of the e-mail message. If -emtext is omitted, a default message will be used. If HTML tags are detected in the text, the message will be formatted as an HTML message.

To load the message body from a file, use

-emtext="@filename"

where filename is the file that the body should be loaded from at runtime. If the file has extension ".htm" or ".html" the message will be formatted as an HTML message. Otherwise it will be formatted as a plain text message (no check is done for HTML tags in the file).

If you are exporting your report to HTML or plain text format, you can use the export file as the message body by specifying

-emtext=@

(with no file name specified)

-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"

This value can contain variables and functions that are replaced at runtime.

-emreceipt Requests a read receipt for the e-mail message.

Logging Options

Report Commander writes informational and error messages to the console (command prompt window). You may also want to have it write output to a log file for later review.

Option Description
-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.

This value can contain variables and functions that are replaced at runtime.

-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

Use the -parameters or -namedparameters option to specify values for the report's parameters.

Automatically inserting date-based values

You can use variables and functions to use the current date (or a date calculated based on the current date) as a parameter value.

Option Description
-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.

This value can contain variables and functions that are replaced at runtime.

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.

This value can contain variables and functions that are replaced at runtime.

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

Conversion Options

Report Commander writes informational and error messages to the console (command prompt window). You may also want to have it write output to a log file for later review.

Option Description
-exportproject="filename"

Creates a new Report Commander project file from the command-line options you have specified. See Creating Projects from Existing Command Lines for more information.

If filename does not have include the ".rcproject" extension, Report Commander will add it.

If the file you specify already exists, Report Commander will return an error and will not overwrite it.