Passing Parameters to a Report in The Report Processor
The Report Processor (TRP) is a powerful command-line tool that simplifies the generation of reports. One of TRP's standout features is its ability to accept parameters, offering customized outputs tailored to your specific needs. This guide aims to provide a comprehensive overview of this feature.
Basic Command
trp export C:\Reports\Orders.rpt [options]
The command displayed above is your basic TRP command structure. Replace 'C:\Reports\Orders.rpt' with your desired report file path. The term '[options]' refers to the additional settings you can adjust to further customize your command. This guide will predominantly focus on the 'parameter' option.
Parameter Option
The parameter option lets you feed parameters into the report. You can denote this option using the -p
or --parameters
flag. Here is a simple example of how to use it:
trp export C:\Reports\Orders.rpt --destination C:\Exports\Order12345.csv --parameters "OrderNumber=12345"
In the command above, we're passing the "OrderNumber" parameter with a value of 12345 to the report. Consequently, the report generates data for order number 12345 and exports it as a CSV file.
Examples
Here are some practical examples demonstrating the use of the parameter option, organized by increasing complexity:
trp export C:\Reports\Orders.rpt --destination C:\Exports\SingleOrder.csv --parameters "OrderNumber=12345"
trp export C:\Reports\Orders.rpt --destination C:\Exports\FirstQuarterOrders.csv --parameters "DateRange=2023-01-01;2023-03-31"
trp export C:\Reports\Orders.rpt --destination C:\Exports\MultipleOrders.csv --parameters "OrderNumbers=12345|54321|11223"
trp export C:\Reports\DepartmentSales.rpt --destination C:\Exports\DepartmentSales.csv --parameters "DepartmentIDs=Dept003|Dept004"
trp export C:\Reports\CustomerOrders.rpt --destination C:\Exports\CustomerOrdersQ1.csv --parameters "CustomerID=C128&DateRange=2023-01-01;2023-03-31"
Remember, your parameter values need to exactly match the names recognized by the report. Consult your report documentation to ascertain the exact parameter names.
Harnessing parameters with TRP significantly boosts the tool's flexibility and effectiveness. By automating your reports and supplying the right parameters, you can optimize your operations and ensure the right data is available precisely when you need it.