Create custom reports with External Reports
Use External reports to generate custom reports directly from OperaJM. OperaJM prepares the data, images, and resources for either the integrated JasperReports pipeline or a script you configure.
Configure the report in OperaJM
- From the main menu, open Print → External reports. The External Reports archive (
RPE) lists the reports configured in OperaJM. - Configure the data and images the report needs, then choose the Layout type.
- Use Resources to select the shared resources the report needs, such as a template, stylesheet, or logo.
- Use Parameters to define the names and values the report needs.
| Layout type | How OperaJM generates the report |
|---|---|
| None | Runs the command configured in Program. |
| Jasper Report | Uses the integrated JasperReports pipeline with the report layout selected in Resource. |
Manage shared report resources
The External reports resources archive (OPERARRE, archive code RRE) is a shared pool of files and images. A report selects its resources by their unique names in its Resources list.
| Resource field | What it controls |
|---|---|
| Name | Unique name used to link the resource to a report. |
| Type | Generic file, image, or a dedicated JasperReports file type. |
| Filename | Name OperaJM uses when it writes the resource into %WORKDIR%. |
| File | Optional path to the original source file. Use it to refresh the stored resource while editing. |
When you print the report, OperaJM writes the resources associated with it into %WORKDIR% under their configured filenames. For example, a resource named Company logo with the filename company-logo.png is available to the report as %WORKDIR%\company-logo.png.
OperaJM stores the file or image content in OPERARRE, so it is included in the Opera database backup. Users connected to the same database can print with the stored copies even if the original files are unavailable to them.
If File contains a source path, OperaJM checks the source file's modification timestamp before each print. When the source has changed, OperaJM automatically re-imports it before writing the resource to the workspace. This lets you edit a template and print again to see the changes.
Configure the script pipeline
- Give the report a unique Name in the archive and choose its Type.
- Set Layout type to None. Set Program to the command line that launches the script. If you keep editable source files in a separate folder, set Driver dir to that folder relative to the configured External reports base path. The command can run Python, PHP, or any other program you can launch from a script.
- Choose the Output type and any language or file-opening options.
Choose the report type
The Type determines which data OperaJM exports for the script.
| Type | Script input and example use |
|---|---|
| Job | Job details XML for a document such as a quote. |
| Job Parts List | XML with the job’s bill of materials (BOM). Use it to prepare a purchase order from the parts a job needs. |
| Machinings | Job XML with machining operations. Use it to forecast manufacturing time by department. |
| XPath | Job details XML plus the XPath of the element to print. The script uses the supplied XPath to select that element. |
| Order | Purchase order data from OperaJM inventory for a custom purchase order form. |
| Movements | Inventory movement data for a document such as a packing slip. |
Choose the output and document language
- Output type. Choose Print to have OperaJM’s print system handle
%WORKDIR%\output.pdf. If you choose a specific format, OperaJM passes the selected format to the reporting procedure and provides the destination directory as%dir%. Have the procedure write the report in that format to that directory. - Document language. Select a language to have OperaJM export descriptions in that language. OperaJM also passes the language code to the script.
- Customer language. Use the language associated with the job’s customer.
- Open. For a specific output format, select this option to open the report file after it is created.
Read the script environment
OperaJM provides these environment variables to the script.
| Variable | Value |
|---|---|
%WORKDIR% |
Temporary workspace for the report run. |
%<parameter_name>% |
Value of the parameter with that Name when its Environment variable checkbox is selected. |
For a sensitive value such as a password, also select Hidden. OperaJM sets the variable silently. The setting applies to how OperaJM passes the variable to the script. The generated XML can still contain the value in <par_value>.
Configure the JasperReports pipeline
- In External reports, set Layout type to Jasper Report.
- In Resource, select a record from the External reports resources archive with type Jasper Report Source File (
*.jrxml). This is the main report layout. - Add any supporting resources to the report’s Resources list.
OperaJM uses the JasperStarter command-line tool. It downloads and installs JasperStarter automatically when needed. When you run the report, OperaJM prepares the files in %WORKDIR% and calls JasperStarter with the arguments for the selected output. When print handling requires a PDF, JasperStarter produces %WORKDIR%\output.pdf for OperaJM.
| Supporting resource type | Use |
|---|---|
Jasper Report File (*.jasper) |
Add the corresponding .jrxml source for a subreport. OperaJM compiles it to .jasper during export when needed. |
Java Font Collection (*.jar) |
Makes the fonts packaged in the JAR available to JasperReports. |
Jasper Report Resources File (*.properties) |
Provides translated strings for multilingual report layouts. |
Read the inputs in %WORKDIR%
For every script report type, OperaJM writes the source XML into the temporary folder identified by %WORKDIR%. Use "%1" in the Program command line to pass the full path of that XML file to your script. OperaJM substitutes the full path when it launches the command. The quotes keep paths containing spaces together as one argument.
OperaJM also writes images for objects referenced in the XML into the workspace. Use the references in the XML to locate those images.
For a job report, OperaJM writes custom parameters under /jobs/parameters/parameter. Read the key from <par_name> and the value from <par_value>. Parameter descriptions, when present, use <par_description>. The parameter names and their meaning are defined by your report. For example, a production checklist could use a parameter named report_title.
<parameters>
<parameter>
<par_name>report_title</par_name>
<par_value>Production checklist</par_value>
</parameter>
</parameters>
Generate output.pdf for Print
The procedure can use any PDF renderer that can read the prepared inputs and run in your OperaJM environment. For the production checklist, it could read the job rows, add the exported images, and use the supplied title in the page header.
When Output type is Print, save the completed PDF as %WORKDIR%\output.pdf. Finish writing and close the file before the procedure exits so OperaJM can pick it up.
Install a report with operac
An AI agent can prepare the report definition and its resource files, then install them through the archive imports.
- Prepare the report definition as archive XML. Give the report a unique name and reference its resources by their unique names. Import the definition into
RPEwithoperac -irpe "report.xml". - Prepare the resource archive XML with the named resource records, their configured filenames, and their file contents. Import it into
RREwithoperac -irre "resources.xml". - If the user wants to edit the original files, create a subdirectory under the configured External reports base path, save the editable files there, and set the report’s Driver dir and each resource’s optional File path. OperaJM can then refresh the stored copies when the source files change.
Steps 1 and 2 are enough to install a report that uses embedded resources. OperaJM stores the files in the database and writes them to %WORKDIR% when the report runs. For a script stored as a resource, point Program to the staged script in %WORKDIR%.
Use the archive XML import rules when preparing the two input files.
Set the script directory relative to External reports
Use a leading + in Driver dir to resolve the script folder against the External reports base path in OperaJM’s directory configuration. For example, if that base is \\server\OPERA\externalreports, enter +quote as Driver dir. OperaJM expands it so %driverdir% points to \\server\OPERA\externalreports\quote.
The report can use the same Driver dir value across the network. Each OperaJM client resolves it against its configured base path.
Run a job report from the command line
Use operac with -dreport:<report_name>. Supply the report name configured in the RPE archive, the job ID with -jid, and the job year with -jyear. For example, if the report is named production_checklist, this command runs it for job 18/2026.
operac -dreport:production_checklist -jid18 -jyear2026
To find report names and see how to make the equivalent request over HTTP, see Discover job reports and documents.