Using dynamic resources

When you drag cube elements from the Resource View panel to analyze data of a report, sometimes you may find that the cube elements that have been predefined in the business/report cube cannot meet your requirements, in which case, you can create some dynamic resources and use them in the report to get the desired data. Then when you save the report, the dynamic resources will be saved along with the report as report resources. Dynamic resources in JReport Web include formulas and measures.

Creating and using dynamic formulas

To create a dynamic formula, follow the steps below:

  1. In the Resource View panel, expand the Dynamic Resources > Formulas node, then click <Add Formula…> to display the Formula Editor window. See the window.
  2. Enter a name for the formula in Formula Name text field.
  3. Compose the formula by selecting the required fields, functions and operators from the Fields, Functions and Operators panels. You can also write the formula by yourself in the editing panel.

    For details about the functions and operators, refer to Built-in functions and Operators in the JReport Designer User's Guide.

  4. Click the Check button to check whether or not the syntax of your formula is correct.
  5. When done, click the OK button to create the formula.

Once a dynamic formula has been created, you can then drag it from the Resource View panel to the desired position in the report as a detail information object for data analyzing. The formulas can also be used to control object properties if you are an advanced user and provided that the Use Dynamic Formula in Property is checked on the Report menu.

Also, if you want to further edit an existing formula or remove any formula that is not required, right-click the formula and then click the corresponding command on the shortcut menu. However, if the formula has been used in the report or referenced by another formula, it cannot be deleted.

Notes:

Creating and using dynamic measure objects

In JReport Web, you can also create dynamic measure objects by mapping them to the available resources which include dimension objects, detail information objects in the current business/report cube and the dynamic formulas that have been created in the report.

To create a dynamic measure object:

  1. In the Resource View panel, expand the Dynamic Resources > Measures node, then click <Add Measure…>. The Add Measure dialog is then displayed. See the dialog.
  2. In the Measure Name text field, specify the display name of the measure.
  3. Click the chooser button next to the Mapping Name text field to specify the mapping name of the field to which the measure object is mapped.
  4. From the Aggregate drop-down list, specify the aggregate function for the measure object.
  5. When done, click OK to create the measure object.

If you want to create a measure object on a dynamic formula you have created, right-click the formula in the Dynamic Resources > Formulas node in the Resource View panel, then select Create Measure from the shortcut menu. In the Add Measure dialog, specify the display name of the measure object and the aggregate function as required, then click OK.

Once a dynamic measure object has been created, you can then drag it from the Resource View panel to the desired position in the report so as the get the desired data. And if you want to edit any dynamic measure object or delete it, right-click the measure object and click Edit or Delete on the shortcut menu (a measure object that has been used in report cannot be deleted).

Note: From Version 9 on, the display names of the objects in a category in business/report cubes cannot be duplicated. Thus, when you choose to create a dynamic formula/measure object on an object which has duplicated display name with another object, you will be prompted with a message, asking you to give a new name for the object in JReport Designer first.