Binding a link to a label

You can make the labels in a report linked with other reports, locations specified by URLs, e-mail addresses, or Blob data type fields. 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 labels that are not bound with datasets.

To bind a simple link to a label:

  1. Right-click the label 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 label will be linked: Report, Master/Detail Report (available to page report only), URL, E-mail or Content.
  3. Specify the options for the link target.
  4. When done, click OK to create the link.

To bind a conditional link to a label:

  1. Right-click the label and click Link on the shortcut menu to display the Insert Link dialog.
  2. Check the Conditional Link checkbox.
  3. Click above the conditions box. The Edit Conditions dialog appears. See the dialog.
  4. Click the Add Condition button to add a condition line.
  5. From the field drop-down list, select the field on which the condition will be based.
  6. Choose the operator with which to compose the condition expression from the operator drop-down list.
  7. From the value drop-down list, specify the value of how to build the condition. You can also type in the value manually.
  8. Click Add Condition to add more condition lines and define the relationship between the condition lines.
  9. When done, click OK to save the condition. The newly added condition will then be displayed and highlighted in the conditions box in the Insert Link dialog.
  10. From the Link Type drop-down, select the target to which the label will be linked under this condition: Report, Master/Detail Report (available to page report only), URL, E-mail or Content, then specify the options for the link target.
  11. Repeat the above steps to add more conditions and define the target for each condition.

    To edit a condition, select the condition, click , then edit it in the Edit Conditions dialog.

    To adjust the priority of the conditions, select a condition and click the or button.

    To remove a condition, select the condition and then click .

  12. Check the Others checkbox and define a target to which the label will be linked when none of the condition you have specified is met.

  13. When done, click OK to create the conditional link.

For an illustrated example, see Example of binding a conditional link.

When a link is created, you can further edit it or remove it if you want.

See also the Insert Link dialog for page report or web report/library component and the Edit Link dialog for page report or web report/library component for additional information about options in the dialogs.

Tip: By default, the link action has the highest click priority at runtime. You can change the priority by setting the report's Click Priority property.

Linking to another report

In most cases, your reports are affiliated with one another, with each report emphasizing one or more aspects of a bigger picture. Relationships can be set up for users to browse from one report to another through the relationship "channels" created. You can achieve an inter-report relationship network by setting up the link conditions between two reports in the same catalog. Then, when you view the primary report at runtime, you can gain access to the linked report by clicking a trigger, which is an object defined in the primary report to load a linked report.

Usually, you can use a label, a field (DBField, summary, formula, parameter, or special field), or an image as a trigger object.

To make a label linked to another report:

  1. In the Insert Link dialog, select Report as the link type. See the dialog.
  2. If the primary report is a page report, click the Browse button next to the Report text field to specify the page report in the same catalog that contains the report tab you want as the linked report. Then, select the report tab name from the Report Tab drop-down list.

    If the primary report is a web report or a library component, click the Browse button to specify the web report in the same catalog that you want as the linked report.

  3. From the Target drop-down list, select where the linked report will be loaded.

    The Target property works when the link is triggered in Page Report Studio or Web Report Studio. When the link is triggered in JDashboard, except for Same Frame, all the other targets are treated as New Window.

  4. Click the More button to display more options for setting the link.
  5. In the Filter tab, click the button above the Components box. In the Choose Component dialog, add the components in the linked report you want to be interlinked with the primary report. If the required components use different datasets, you need to add them respectively, however, as long as the components are based on the same dataset, you can add them all at a time.
  6. Specify the filter conditions based on which the link relationship between the primary report and the selected components in the linked report is set up.
    1. Select a component from the Components box.
    2. Click above the Field Conditions box and a condition line is added.
    3. Select the desired field of the primary report from the drop-down list in the Fields(Primary) column.
    4. Choose an operator from the drop-down list in the OP column.
    5. Specify the field/formula 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 are available in the drop-down list.
    6. If necessary, you can specify more 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 between these conditions is AND, which means that JReport will fetch linked report data which meets all of the conditions.
    7. Repeat the above steps to set link conditions between the primary report and other components in the linked report.
  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.
  8. If the linked report contains one or more parameters, the Parameters tab will be enabled. In this tab, you can assign field of the primary report to parameter of the linked report. Then, when running the linked report from the link, the field value of the primary report will be assigned to the parameter automatically.
  9. If you would like the values of the filter objects such as filter controls and sliders in the primary report to be passed to filter objects in the linked report, go to the Advanced tab to set up the relationship between the filter objects as follows:
    1. Click to add a line.
    2. In the Primary Report Property/Object column, click to select a filter object in the primary report in the Select Value dialog and click OK.
    3. In the Linked Report Property/Object column, click to select a filter object in the linked report in the Select Value dialog and click OK. You need to make sure that values of the filter object in the primary report can be applied to the filter object in the linked report in the same line.
    4. Follow the above steps to set up the relationship between more filter objects.
  10. Check Pass style group information down to the linked report to transfer style information from the primary report to the linked report, so that the style of the primary report will apply to the linked report.
  11. Click OK to apply the settings.

Then, when you run the primary report at server runtime and click the label, you will find that the linked report is displayed according to the specified link conditions. You can also trigger the link in the HTML, PDF or Excel result if you check the Run Linked Report option in the corresponding format's export/option dialog.

Notes:

Linking to a detail report

Reports in the same catalog can be joined together in order to create a master/detail report group. Usually, the master report holds comprehensive data, while the detail reports hold related detailed information. A detail report can also be the master report of another report. In this way, you can set up more pairs of master/detail reports, where many reports are joined together, eventually leading to the formation of a report chain. Then, when you view the master report at runtime, you can gain access to the detail report by clicking a trigger, which is an object defined in the master report to load a detail report. However, in a master/detail report group, crosstab reports cannot be used as the master.

Usually, you can use a label, a field (DBField, summary, formula, parameter, or special field), or an image as a trigger object.

Master/detail report is supported on page report only at present.

To make a label linked to a detail report:

  1. In the Insert Link dialog, select Master/Detail Report as the link type. See the dialog.
  2. Click the Browse button next to the Report text field to specify the report in the same catalog which contains the report tab you want for the detail report, and then select the report tab name from the Report Tab drop-down list.
  3. Click the Browse button beside the Component field. In the Choose Component dialog, specify which component in the detail report you want to be interlinked with the master report with conditions. You can select more than one component as long as the components are based on the same dataset.
  4. From the Target drop-down list, select where the detail report will be loaded.
  5. Specify the join relationship between the master report and detail report in the Anchor section. The join can only have one condition. For example, the join can be: (Detail Report) Product ID = (Master Report) Product ID. The join condition should be as:

    (Detail RPT) expression1 operator (Master RPT) expresion2

    To make the join more meaningful, expression1 should be a column or record level formula in the GROUP section of a component in the detail report; and expression2 should be a column or record level formula in the DETAIL section of a component in the master report. This is because generally the master report is used to present comprehensive data, and the detail report to present more detailed information. To specify the join condition,

    1. Select a field/formula from the Column in Detail Report drop-down list. If this list does not offer the required field/formula, then you will need to specify the component with the data source that contains the specific field/formula. To do this, specify the component by clicking the Browse button besides the Component field.
    2. Choose the operator from the Operator drop-down list.
    3. Specify the field/formula of the master report from the Column in Master Report drop-down list. This field/formula should be of the same data type as the selected field/formula of the detail report.
  6. Click the More button to display more options for setting the link.
  7. In the Conditions tab, specify the filter conditions between the master report and the detail report.
    1. Click the add button above the Field Conditions box and a condition line is added.
    2. Select the desired field of the master report from the Fields(MasterReport) drop-down list.
    3. Choose an operator from the drop-down list in the OP column.
    4. Specify the field/formula of the detail report from the drop-down list in the Fields(DetailReport) column. All fields in the detail report of the same value type as the selected primary report field are available in the drop-down list.
    5. If necessary, you can specify more conditions by clicking the button and then specifying the master report field, the operator, and the corresponding field in the detail report. You can use the More column to specify the relationship between conditions to be AND or OR.
  8. If there is at least one parameter applied in the filters of the queries that the detail report uses, the Parameters tab will be enabled. In this tab, you can assign field of the master report to parameter of the detail report. Then, when running the detail report from the link, the field value of the master report will be assigned to the parameter automatically.
  9. If both reports use the same encoding and DB settings, you should check the option Use the same encoding and DB settings for the detail report as that of the master report. If this option is not checked, when the detail report is triggered at runtime, you will be prompted to specify the encoding and DB settings for the detail report.
  10. Click OK to confirm.

After a set of master/detail reports have been defined in JReport Designer and published to JReport Server, they can be viewed in Page Report Studio. The detail report supports all the page report operations, such as sort, filter, drill, and search.

Notes:

Linking to a URL

  1. In the Insert Link dialog, select URL as the link type. See the dialog.
  2. Enter the URL in the Hyperlink text box directly. If needed, click the Add Dynamic Field button to insert a field into the URL to compose a dynamic URL.

    For example, you can compose a URL as follows: type in http://www.google.com/search?q= into the Hyperlink text box, then click the Add Dynamic Field button to insert the field Country at the end of the URL. Then at runtime, you can click the label to open a specific URL that directs to a specific country.

  3. Specify the frame from the Target drop-down list.

    The Target property works when the link is triggered in Page Report Studio or Web Report Studio. When the link is triggered in JDashboard, except for Same Frame, all the other targets are treated as New Window.

  4. When done, click OK to set up the link.

Then, when you run the report at server runtime, or view it in HTML, PDF, or Excel format, you can click the label to open the URL.

Linking to an e-mail

  1. In the Insert Link dialog, select E-mail as the link type. See the dialog.
  2. Enter the e-mail address in the Hyperlink text box directly. If needed, click the Add Dynamic Field button to insert a field into the e-mail address to compose a dynamic e-mail address.
  3. When done, click OK to set up the link.

Then, when you run the report at server runtime, or view it in HTML, PDF, or Excel format, you can click the label to open the e-mail with the information specified in the Hyperlink box. You can further customize the e-mail and send it.

Linking to a Blob data type field

You can make an object linked with a Blob data type field. The Blob data type field will then be bound to the object and displayed as a hyperlink. You can download the Blob content by clicking this hyperlink.

In JReport, Blob could be image, Binary, Blob, Clob, LongBlob, LongClob, Varbinary, Longvarbinary, and so on.

To make a label linked to a Blob data type field:

  1. In the Insert Link dialog, select Content as the link type. See the dialog.
  2. From the Query drop-down list, select the query (page report) or query based business view (web report and library component) which contains the required Blob data type field. Only queries/business views that come from the same data source connection as the query/business view used by the current report are available in the drop-down list.
  3. From the Content Type drop-down list, specify the content type for the Blob type data. You can also click the button to bind the content type with a field or a formula in the selected query/business view.
  4. In the File Name text field, specify a file name for the linked Blob type data. You can also click the button to specify a field or a formula in the selected query/business view to control the file name.
  5. From the Content drop-down list, choose a Blob data type field in the selected query/business view.
  6. Click the More button to display more link options.
  7. In the Filter tab, specify the filter conditions between the query/business view used by the current report and the query/business view that contains the linked Blob content as follows:
    1. Click above the Field Conditions box and a condition line is added.
    2. Select the desired field of the query/business view used by the current report from the Fields(Primary) drop-down list.
    3. Choose an operator from the drop-down list in the OP column.
    4. Specify the field/formula of the query/business view that contains the linked Blob content from the drop-down list in the Fields(Linked) column. All fields that are of the same data type as the selected field in the Fields(Primary) column are available in the drop-down list.
    5. If necessary, you can specify more conditions by clicking the button and then specifying the fields and operators accordingly. Note that the relationship between these link conditions is AND, which means that JReport will fetch the linked Blob type data which meets all of the conditions.
  8. If the query/business view that contains the linked Blob content uses parameters, the Parameters tab will be enabled. In this tab, you can assign fields of the query/business view used by the current report to the parameters. Then, when accessing the Blob type data from the link, the field values will be assigned to the parameters automatically.
  9. Click OK to apply the settings.

Then, when you run the report at server runtime, or view it in HTML, PDF, or Excel format, you can click the label to download the Blob content according to the specified conditions.

Example of binding a conditional link

This example shows the usage of conditional link and dynamic field.

  1. Open the report Link.wls located in <install_root>\Demo\Reports\SampleReports\SampleReports.cat.
  2. We will define a link on the table of the report. Right-click on the Product Name field in the second group header row and then select Link from the shortcut menu.

  3. In the Insert Link dialog, check the Conditional Link checkbox.
  4. Click to define a condition in the Edit Conditions dialog as follows.

  5. 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 Message dialog, click Yes.
  6. 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.

  7. 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.
  8. From the Link Type drop-down list, select E-mail. In the Message dialog, click Yes.
  9. 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 @.

  10. Click OK in the Insert Link dialog.
  11. Click View > Preview As > Web Report Result on the menu bar to view the report results in Web Report Studio. We can click the product names in the table to trigger the link.
  12. 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: