Using RunReport.exe from a command line

Syntax

This is the syntax to run RunReport.exe from a command line:

RunReport.exe switches

where switches must be preceded by either a minus sign ( - ) or a forward slash ( / ).

If the -m switch is used, it must be the last switch. The order of the other switches does not matter.

Any switch that is used must be followed by the appropriate value. All switches, other than -m, require their values to be enclosed in parentheses if the value contains blank spaces. The value following -m must not be enclosed in parentheses.

Switches

These are the switches that can be used in the RunReport.exe command line:

Switch Description
-h (Optional) Use this switch to designate the TaskMan home directory, where taskman.exe runs.

If this parameter is omitted, RunReport.exe uses its own directory.

-t (Optional) Use this switch to designate the Task Number.

For reports run through TaskMan, this is the Task Num field on the Active Background Tasks form, and the Task Number field on the Background Task History form. This number is generated by SQL when a record is inserted into the ActiveBGTasks table.

-r (Required) Use this switch to specify the name of the report.
-d Use this switch to designate the the DSN for the ODBC that RunReport.exe uses to connect to the database.

Use this switch with the -db parameter if you are using either ODBC (RDO) or OLE DB (ADO) to connect to an ODBC data source to access the database.

This parameter is ignored if you are using a direct OLE DB (ADO) connection to the SQL database.

-p Use this switch to specify the password for the ODBC connection, or for the SQL database, if you are using a direct OLE DB (ADO) connection.

This value defaults to an empty string.

-l Use this switch to specify the user login for the SQL database, if you are using a direct OLE DB (ADO) connection.

This value defaults to sa.

-u (Optional) Use this switch to specify the user ID of the person submitting the report.

This refers to the User ID field on the Users form. It is also displayed on the Background Task History form, for tasks submitted to TaskMan.

-db Use this switch to specify the name of the Application Database.

This is used to set the location for the main report and subreport data sources. If omitted, the data sources are left as is.

-g (Optional) Use this switch to specify the User Group ID.

If provided, this is used in a SQL WHERE clause when querying the Strings table. It is used to filter on the ScopeName (the user’s group) and the ScopeType (2, for Group).

-session (Optional) Use this switch to designate the Session Identifier, passed when TaskMan calls RunReport.exe, to indicate the session for which variables can be accessed by the report's stored procedure.
-s (Optional) Use this switch to specify the name of the Strings table used to translate report labels.

RunReport.exe uses an ODBC connection to the application database to query the Strings table, so the table name must be qualified enough for the query to work.

If the Strings table is in a Forms Database on the same server as the Application Database, then the Strings table name must include that database name (for example, Formsdb.dbo.StringTable.)

If the Strings table is in a database on a different server, then this server must be a linked server, and the Strings table name must include both the server name and the Forms Database name (for example, Server.Formsdb.dbo.StringTable).

If this parameter is omitted, the report runs, but the labels are not translated and display as literal string names. In addition, a warning message is placed in the error log.

-f (Optional) Use this switch to designate the integer code for the report output format:

1 - No longer used

2 - Acrobat Format (PDF)

3 - Comma Separated Values (CSV)

4 - Excel 8.0 (format used with Excel 97 and Excel 2000)

5 - Excel 8.0 extended (format used with Excel XP and Excel 2003)

6 - HTML 4.0

7 - Printer

8 - No longer used

9 - Word for Windows (DOC)

10 - XML

11 - No longer used

12 - MHTML

13 - TIFF

-o (Optional) Use this switch to designate the output file name.

If this is omitted, RunReport.exe uses this format:

HomeDir\Report\OutputFiles\UserName\TaskName_Site_TaskNum.Extension

where:

  • HomeDir is the root directory where reports are to be output.
  • UserName is the user ID of the individual or account from which the report is being generated.
  • TaskName is the name of the task as generated by RunReport.exe.
  • Site is the name of the site (if any).
  • TaskNum is the task number as generated by RunReport.exe.
  • Extension is the extension for the type of output being generated.
-n (Optional) Use this switch to specify the number of copies to print, if the report output is to be sent directly to a printer (output format 7).

The default value is set using the printer settings.

-e (Optional) Use this switch to specify the name of the error file that WinStudio generates for report errors.

If a file name without a path is passed in, RunReport.exe prepends this to the path:

HomeDir\Report\Errors\UserName\

where:

  • HomeDir is the root directory where reports are to be output.
  • UserName is the user ID of the individual or account from which the report is being generated.

If this parameter is omitted altogether, RunReport.exe uses the format:

HomeDir\Report\Errors\UserName\TaskName_TaskNum.txt

where:

  • HomeDir is the root directory where reports are to be output.
  • UserName is the user ID of the individual or account from which the report is being generated.
  • TaskName is the name of the task as generated by RunReport.exe.
  • TaskNum is the task number as generated by RunReport.exe.

TaskMan puts the contents of this file in the Error Message field on the Background Task History form and then deletes the file.

-prt (Optional) In cases where the output is to be sent directly to a printer, use this switch to designate the name of the printer.

If the printer is not local, this value should be the UNC path/name.

If omitted, this value defaults to the default printer of the machine where RunReport.exe is running.

-site (Optional) Use this switch to specify the name of the site, from the Sites (or Sites/Entities) form.

This value is used as part of the output file name. This parameter is used so that, if TaskMan is monitoring multiple databases, the report output from one database does not overwrite that from a different database.

-config (Optional) Use this switch to designate the application configuration to which you are connected.
-svr (Optional) Use this switch to designate the name of a SQL Server to override the SQL Server setting from the configuration that points to the application database.
-debug (Optional) Use this switch to generate a debug/error file in the Errors directory (Report/Errors, rather than Report/OutputFiles).
-m (Optional) Use this switch to indicate that the rest of the command line is a comma-delimited list of report-specific parameters. RunReport.exe parses this list and plugs these values into the report’s parameters.

This switch must be the last one used in the command line. If any other switches occur after this one, RunReport treats them as report parameters.

RunReport.exe supports the ~LIT~(...) keyword.