Binding links to objects

You can bind links to labels, images, DBFields, formula fields, parameter fields, special fields, and data markers on charts of bar, bench, pie, line and area types. The link can either be a simple link or a conditional link. With conditional link, different targets can be loaded based on different conditions. However, conditional link is not supported on charts and independent labels that are not bound with a dataset.

To bind a simple link to an object:

  1. Right-click the object and click Link on the shortcut menu to display the Insert Link dialog.
  2. From the Link Type drop-down, select the target to which the object will be linked.
  3. When done, click OK to create the link.

To bind a conditional link to an object:

  1. Right-click the object and select Link from the shortcut menu to display the Insert Link dialog.
  2. Check the Conditional Link checkbox.
  3. Click the button to open the Edit Conditions dialog to define a condition using either simple expressions or complex expressions according to your requirements.

    The newly added condition will then be displayed and highlighted in the conditions box in the Insert Link dialog.

  4. From the Link Type drop-down, select the target to which the object will be linked under this condition.
  5. Repeat the above steps to add more conditions and define the link target for each condition.

    To edit a condition, select the condition in the Condition box, then click . In the Edit Conditions dialog, edit the expressions as required.

    To remove a condition and the corresponding format, select the condition in the Condition box and click .

    To adjust the priority of a condition, select the condition in the Condition box and then click or .

  6. When done, click OK to finish defining the conditional link.

For an illustrated example, see Example of binding a conditional link. See also Insert Link dialog for additional help about options in the dialog.

Once a link is added to an object, you can further edit it or remove it.

Linking a report to another report

A report can be linked to another report, after which the trigger object in the primary report can be clicked in order to jump to the linked report to obtain information about the trigger object.

  1. In the Insert Link dialog, select Report as the link type. See the dialog.
  2. Click the Browse button beside the Report text field to specify the target web report you want as the linked report.
  3. Specifies the window or frame in which to load the linked report from the Target drop-down list.
  4. Click the Advanced button to displays the advanced settings.
  5. In the Conditions tab, click above the Components box to specify which components in the linked report will be interlinked with the primary report.
  6. Select a component in the Components box, then specify the link relationship for the selected target component in the Field Conditions box as follow:
    1. Click the button above the Field Conditions box, then a new condition row will be added.
    2. Select a field from the drop-down list in the Fields(Primary) column.
    3. Choose an operator from the drop-down list in the OP column. The operator can be "=", "<>", "<", ">", "<=", ">=", or "IN".
    4. Specify the field of the linked report from the drop-down list in the Fields(LinkedReport) column. All fields in the linked report of the same value type as the selected primary report field will be available.
    5. If necessary, you can specify more link conditions by clicking the button and then specifying the primary report field, the operator, and the corresponding field in the linked report. Note that the relationship among these link conditions is AND, which means that JReport will fetch linked report data which meets all of the conditions.
    6. Repeat the above steps to set link conditions for other target components.
  7. From the Default Linked Component drop-down list, select which component in the linked report will be linked with the primary report by default. Then, when the primary report is opened in HTML, PDF or Excel format, or in Web Report Studio, the page where the data that meet the predefined condition in the specified component in the linked report will be displayed by default after you click the link.
  8. If the linked report uses parameters, go to the Parameters tab, the Target Report Parameters box lists the parameters of the linked report. You can assign fields of the primary report to the parameters. Then, when running the linked report from the link, the field values of the primary report will be assigned to the parameters automatically.
  9. Click OK to apply the settings.

Then, when the primary report is run in Web Report Studio, or in HTML, PDF or Excel format with Run Linked Report being selected, the link will be enabled, and when you click the trigger object in the primary report, you will find that the linked report is displayed according to the specified link conditions.

If the linked report is opened in the same frame as the primary report in Web Report Studio, you can click on the toolbar to go back to the primary report. Click next to and you will get a drop-down list which lists the original report and the linked targets you have just visited within the link chain. The item checked on the drop-down list is the currently opened page. Select an unchecked item and you will be directed to that target.

Notes:

Example of binding a conditional link

This section provides an example to show the usage of conditional link and dynamic field.

  1. Run the report Link.wls located in the /SampleReports folder.
  2. Click Edit Mode on the toolbar.
  3. We will define a link on the table of the report. Right-click on a Product Name value and then select Link from the shortcut menu.
  4. In the Insert Link dialog, check the Conditional Link checkbox.
  5. Click to define a condition in the Edit Conditions dialog as follows.

  6. We will make the field linked to a URL target based on the condition. From the Link Type drop-down list, select URL. In the Confirm dialog, click Yes.
  7. In the Hyperlink text box, type in http://www.google.com/search?q= and then click the Add Dynamic Field button to insert the field Product Name at the end of the URL.

  8. For the product names other than Blue Mountain and Breakfast Blend, we will make them linked to an e-mail target. Check the Others checkbox. A condition named Others will be created.
  9. From the Link Type drop-down list, select E-mail. In the Confirm dialog, click Yes.
  10. In the Hyperlink text box, type in @example.com and then click the Add Dynamic Field button to insert the field Product Name right ahead of @.

  11. Click OK in the Insert Link dialog.
  12. We will click the product names in the table to view the link result. Click Blue Mountain and a Google search result page with the key text Blue Mountain will be displayed.

  13. Click Breakfast Blend and a Google search result page with the key text Breakfast Blend will be displayed.
  14. Navigate to the second page of the table, click Sumatra and an e-mail is displayed as follows: