Run and Automate Reports from the Command Line

You can use the Windows command line interface to run a P6 Visualizer report to output the TSLD or Gantt diagram to a printer or a file. You can also schedule automated runs of P6 Visualizer TSLD and Gantt reports jobs using a program like Windows Task Scheduler. The following is a sample actions.xml file that drives the run of one report. All tags must appear in the file; however, you can leave some tags empty, as noted below.

Caution: Personal information (PI) may be at risk of exposure. Depending on local data protection laws organizations may be responsible for mitigating any risk of exposure.

To use the Windows command line interface to run a report, do the following:

  1. Using an XML editor, or any program that can save files as XML files, create an actions.xml file that specifies the report or reports you want to process.

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

    Values are samples that will vary with your configuration.

    Important: Every tag in the XML file is case sensitive.

    <actions>

    <action>

    <reportType>TSLDReport</reportType>

    <reportCategory>Global</reportCategory>

    <reportName>Global default TSLD</reportName>

    <projects>

    <projectId>EC00515</projectId>

    <projectId>NRG00800</projectId>

    </projects>

    <outputType>ToPrinter</outputType>

    <outputName>MyPrinterName</outputName>

    </action>

    </actions>

    Tag

    Description

    Valid Values

    <reportType>

    Required. The type of P6 Visualizer report.

    TSLDReport / GanttReport

    <reportCategory>

    Required. The group name of report, Global, Project, or User.

    Global / Project / User

    <reportName>

    Required. The name of layout.

    Any valid string name

    <projectId>

    Required. Specify one or more valid project IDs. You can specify multiple project IDs by specifying a list of projects separately, each with a separate tag on its own line, such as shown below:

    <projectId>Highway Project </projectId>

    <projectId>RSCD</projectId>

    Valid ProjectId

    <outputType>

    Required. Must be set to ToPrinter or ToXPS.

    ToPrinter / ToXPS

    <outputName>

    Required. Must specify the printer name if "ToPrinter" is set for <outputType>.

    If "ToXPS" is set for <outputType>, must be set to a valid .xps path and filename, for example, to C:\HighwayProjectExport.xps.

    If the full path is not specified and just a file name like myfilename.xps is specified then the default location is the location of Primavera.Visualizer.exe.

    Default location of Primavera.Visualizer.exe is: local drive\Program Files\Oracle\Primavera P6\P6 Professional\P6Tools.
    If an invalid path is specified, like C:\folder123\myfilename.xps, then the output file will be at %TEMP% and you may see a message in the log such as, "Can not copy file to C:\folder123\myfilename.xps ."
    XPS file: %TEMP%\tmp42E2.Xps

     

    Note:

    If you include non-English characters in the actions.xml 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.

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

    Primavera.Visualizer.EXE /username=<name>

    [/password=<name>]

    [/alias=<name>] /actionScript=<path>

    [/logfile=<path>]

    [/language=<Language>]

    Parameter

    Description

    /username=<name>

    Required. The username to log in to P6 Visualizer.

    /password=<name>

    The password for the username, if there is one 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. You must include the file name. If missing, P6 Visualizer opens.

    /logfile=<path>

    Optional. The full path for creating the log file that contains processing results. You must include the file name. If the logfile is not set, the default log file destination is PrimaveraVisualizerCmd.log in the User's Temp folder, for example %TEMP%.

    /language=<Language>

    Optional. If missing option, it will take the currentLangauge in the PrmBootStrap.xml.

    Valid Values for Language include:

    • en-us for English
    • de-de for German
    • fr-fr for French
    • ja-jp for Japanese
    • ru-ru for Russian
    • zh-cn for Chinese Simplified
    • zh-tw for Chinese Traditional
    • es-es for Spanish
    • pt-br for Brazilian Portuguese
    • it-it for Italian
    • ko-KR for Korean

    Notes:

    • No space before/after the = sign.
    • A space must exist between parameters. Each parameter starts with /.
    • The entire string must be entered on one line.
    • If any values include spaces, enclose the value in quotation marks.

If the process runs successfully, then an exit code of 0 is returned; if any errors are logged to the log file, an exit code greater than 0 is issued, which indicates failure.

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.

-5

Missing Script File.

-6

Bad Script File.

-7

Login Failed.

-8

Alias Failed.

If the command does not include the parameter/actionScript, P6 Visualizer opens.

Related Topics

Working with P6 Visualizer Reports



Legal Notices | Your Privacy Rights
Copyright © 1999, 2020

Last Published Friday, October 1, 2021