Adding commands before or after the document-style report generation process

The pre-command property can contain programming code for commands to run before the document-style report publishing process. The post-command property can contain programming code for commands to run after the entire document-style report generation is completed. You must have administrator privileges to add these preprocessing and postprocessing commands in Publishing Document Builder.

Before you begin

About this task

You might use the Post-command property to copy the output files, archive the output files, rename the output files based on variables, mail the output files, or invoke third-party applications. Refer to the documentation for your operating system to learn more about the commands you can use. Example: Microsoft Windows Command-line reference

Procedure

  1. Open the Publishing Document Builder in a browser at the following URL:
    https://server:port/rpeng
  2. Specify the username and password with an administrator (pub_admin) permission to authenticate into the Publishing Document Builder.
    Remember: The username and password depends on the user credentials that are configured and mapped to the pub_admin user roles. See the links on configuring users and authentication for the Publishing Document Builder.
  3. In Publishing Document Builder, click Resources tab.
  4. Optional: If you don't have any resources in Publishing Document Builder, you can generate the ready-to-use and sample resources for Publishing Document Builder. In the Reports tab, click Click here to generate the ready-to-use resources or Click here to generate sample resources.
  5. In the Resources tab, click the Reports tab.
  6. Click the An image of the Edit advanced configuration icon. Edit advanced configuration icon next to the report that you want to add a pre-command or post-command to.
  7. In the Configure report pop-up window, click the Metadata tab.
  8. Scroll to the following fields:
    • Pre-command
    • Stop on pre-command failure
    • Post-command
  9. Enter the values.
    You can use system variables, such as RPE_HOME, or external template variables in your commands. The format is always ${variable}. Template variables take precedence over system variables when they have the same name. You can also use the output formats as variables to indicate the path specified in the output properties. You must write the variable as its name is displayed in the document specification.
    Examples:
    • ${RPE_HOME}
    • ${Html}
    • ${Word}
    • ${PDF}
    • ${New PDF}
    • ${XslFo}
    • ${ModuleName}
    Important: You cannot use any variations to these names, like ${WORD} or ${word}. These variations cannot be recognized by IBM® Engineering Lifecycle Optimization Publishing.
    For example, only the variable ${Word} inserts the path property value specified for the Microsoft Word output. In the log, the variable displays as the value.
  10. Optional: For the Stop on pre-command failure property, enter true or false.
    When set to true, and the pre-command fails, then the document-style report generation stops running. When set to false or no value is entered, and the pre-command fails, then the document-style report generation continues running.
  11. Click Save.

Example

Windows icon To copy the output to a second location, use the following command:

cmd /c copy ${output_format} D:\path\filename.output_extension

When you are writing commands in JavaScript, enter //!JavaScript to the beginning of the code to use the internal JavaScript engine to evaluate the commands:
//!JavaScript
var x = output;
var y = variable;

java.lang.System.out.println( X+Y= + x + y);
1;

What to do next

By default, running the preprocessing and postprocessing commands are disabled. Before you can run any of these commands, the administrator must change the -Dcom.ibm.rational.rpe.enable_commands flag to true. .