Skip to main content
Hitachi Vantara Lumada and Pentaho Documentation

Add Parameters to Your Report

When you set parameters, users are prompted for a value or values when they run the report. The ability to provide parameters is an important part of creating a report.

  1. In the Report Designer, click File > Open to select the report you created.
  2. In the menubar go to Data > Add Parameter. Alternatively, you can click File:/rd_add_parameter.png (Master Report Parameter) under the Data Tab in the Report Designer workspace. The Add Parameter dialog box appears.
  3. In the Add Parameter dialog box, type enter_prodline in the Name text field.
  4. Type Select Line in the Label text field.
  5. Next to Display Type, select Drop Down so users can select a product line.
  6. Click File:/edit.png (Edit) to add a query that supplies the values, (motorcycles, cars, ships, and so on), from which users of the report must choose.
    Note: Click on JDBC (SampleData - Memory) under Data Sources if the Edit icon is disabled.
    The JDBC Data Sources dialog box appears.
  7. Under Connections, select SampleData (Memory).
  8. Next to Available Queries click File:/add.png (Add). A new query placeholder is added to the list (Query 2).
  9. In the Query Name text field, type prodlineList.
  10. Enter your SQL query in the Query box. You can copy and paste the required lines, (shown below) directly into the SQL statement or you can use the alternate steps in the table below.
    Important: Make sure to use curly brackets, (not parentheses), before and after {enter_prodline} or the report will not display correctly.
                            FROM "PRODUCTS"


    By entering these lines, report users see a prompt when they open the report in the Pentaho User Console that allows them to enter a product line. That way, they can examine orders by product line. If you do not add the lines, the report displays orders for all product lines.

    Alternatively, you can use the SQL Query Designer to build your query:
    Step Description
    1 In the JDBC Data Source dialog box, click File:/edit.png (the Edit icon on the right).
    2 In the SQL Query Designer, select the PRODUCTS table on the left.
    3 On the right, click PRODUCTS and choose Deselect All.
    4 Right-click SELECT on the left and choose Distinct.
    5 On the right, select PRODUCTLINE and click Preview. The product line list appears. Click Close.
    6 Click OK to exit the SQL Query Designer and go to Step 11.
  11. Click OK to exit Data Source dialog box.
  12. In the Add Parameter dialog box, under Data Sources, double-click JDBC SampleData (Memory) and select prodlineList.
  13. Next to Value Type, select String.
  14. Type a default value, for example, "Motorcycles," in the Default Value text box. (Optional)
  15. Click OK to exit the Add Parameter dialog box.
  16. Now that you've created a product line parameter, you must map it back to your query (Query 1). Under Data, double-click Query 1.
  17. Right-click PRODUCTLINE and select add where condition. The condition.edit dialog box appears.
  18. Type ${enter_prodline} in the edit area and click OK.
  19. Click OK to exit the /SQL Query Designer.
  20. Click OK to exit the Data Source dialog box.
  21. Click File:/preview_eye.png (Preview).
    You should see your product line drop-down list.
  22. You are now ready to publish your report.