Run a report batch from the command line

You can use the Windows command line interface to run batch reports as a service.

To use the Windows command line interface to run batch reports as a service, do the following:

  1. Using a text editor, or any program that can save text files, create an actions.config file that specifies the batch report you want to run.

    You can specify more than one import action in a single file, by including multiple <action> nodes.

    The following is a sample actions.config file that drives the run of one batch report. All tags must appear in the file; however, you can leave some tags empty, as noted below. Values in bold are literal values you must enter as shown. The other values are samples that will vary with your configuration.

    When connected to a P6 EPPM database:

    <actions>

    <action>

    <type>batchrpt</type>

    <BatchReportName>Project Weekly Reports</BatchReportName>

    <Projects>

    <ProjectID>Highway Project</ProjectID>

    </Projects>

    <outputtype>html</outputtype>

    <outputFile>C:\batchoutput.htm</outputFile>

    <outputFieldDelimiter>,</outputFieldDelimiter>

    <outputTextQualifier>"</outputTextQualifier>

    <StoreReport>Y</StoreReport>;

    </action>

    </actions>

    When connected to a P6 Professional database:

    <actions>

    <action>

    <type>batchrpt</type>

    <BatchReportName>Project Weekly Reports</BatchReportName>

    <Projects>

    <ProjectID>Highway Project</ProjectID>

    </Projects>

    <outputtype>html</outputtype>

    <outputFile>C:\batchoutput.htm</outputFile>

    <outputFieldDelimiter>,</outputFieldDelimiter>

    <outputTextQualifier>"</outputTextQualifier>

    </action>

    </actions>

Tag

Description

<type>

Required. The type of action to take. This is case sensitive.

Valid values: batchrpt

<BatchReportName>

Required. The name of the batch report that is configured in P6 Professional or P6 EPPM.

<ProjectID>

Optional. A project against which to run the report. Leave this tag pair empty to run a global report. Use a separate pair of tags for each Project, for example:

<ProjectID>Highway Project</ProjectID>

<ProjectID>RSCD</ProjectID>

Valid values: Any existing project ID, empty. Do not use an EPS ID.

<outputtype>

Required. What type of output to use for the report.

Valid values: html, text, or printer.

<outputFile>

Required. The path for the output file. For example:

<outputFile>C:\Temp\batchoutput.htm</outputFile>

<outputFieldDelimiter>

The character the report should use to separate fields.

Required when <outputtype> is set to text.

Optional when <outputtype> is set to html or printer.

Valid values: comma (,), semicolon (;), veritcal bar (|), a tab character, or a space character.

<outputTextQualifier>

The character the report should use to enclose text strings.

Required when <outputtype> is set to text.

Optional when <outputtype> is set to html or printer.

Valid values: quotation marks ("), apostrophe ('), or none.

<StoreReport>

Determines whether the report should be stored. Not case sensitive.

Required when P6 Professional is connected to a P6 EPPM database.

Optional when P6 Professional is not connected to a P6 EPPM database.

Valid values: Y for yes, N for no.

Defaults to no if the tag is not found or a value other than Y or y is set.

A message "Warning: Store report to Work Products and Documents disabled." is logged if the value is set to Y or y and any of the following is true:

  • The <Project ID> tag value is blank.
  • Multiple <Project ID> tags are set.
  • You do not have the privilege to Add/Edit/Delete WPs & Docs.
  • The <outputtype> tag value is set to printer.

Note:

If you include non-English characters in the actions.config file, save the file as Unicode and use the XML encoding attribute to specify the language, prior to the <actions> tag. For example, to specify German or French encoding:

<?xml version="1.0" encoding="windows-1252"?>

If you are using a batch file, use the chcp command to specify the appropriate language encoding. See Microsoft.com for more Internationalization details.

  1. Close P6 Professional if it is running.
  2. On the Windows command line, in a batch file, or in code, issue a command in the following form from the folder where PM.EXE is located:

    PM.EXE /username=<name> /password=<name> [/alias=<name>] /actionScript=<path> [/logfile=<path>]

Parameter

Description

/username=<name>

Required. The username to log in to P6 Professional.

/password=<name>

Required. The password for the username.

/alias=<name>

Optional. The name of an existing destination database alias. If you do not specify an alias, the most recently accessed alias is used.

/actionScript=<path>

Required. The full path to the edited actions.xml file. Must include the file name.

/logfile=<path>

Optional. The full path for creating the log file that contains processing results, up to and including the file name. If the logfile is not set, the default log file destination is PrimaveraCmdLineLog.txt in the PM.exe application folder.

For example:

PM.EXE /username=admin /password=admin /alias=PMDB /actionScript=actions.config /logfile=c:\myLog.txt

Note that the entire string must be entered on one line.

If any values include spaces, enclose the value in quotation marks (").

If the batch report runs successfully, then an exit code of 0 is returned. If the batch report fails to run, any errors are logged to the log file and an exit code greater than 0 is returned.

Processing results are written to the log file, or you can echo them to the command line interface. These are the possible results:

Code

Description

0

Success.

1

Invalid alias.

2

Invalid username or password.

3

XML file not found.

4

Invalid action type (did not specify batchrpt).

9

Batch report action failure.

214783647

Unhandled exception, including invalid characters.

If the command does not include all the required parameters, P6 Professional opens.



Legal Notices
Copyright © 1999, 2016, Oracle and/or its affiliates. All rights reserved.

Last Published Wednesday, May 25, 2016