Example of delivering a message

This example demonstrates how to deliver a filter user defined message between two library components. It is divided into the following steps:

  1. Create two library components.
  2. Define to deliver a filter user defined message between the library components.
  3. Publish the library components to JReport Server.
  4. Deliver the message in a dashboard.

Creating the library components

  1. Open the catalog SampleReports.cat.
  2. Use the business view WorldWideSalesBV to create two library components and save them as Component 1.lc and Component 2.lc.

    For Component 1, create a table which displays the Country, Customer Name and City DBFields, is grouped by Region, and uses Total Sales as the summary field. For Component 2, create a crosstab using Country and Region respectively as the row and column fields, and Total Sales as the summary field.

Defining to deliver a filter user defined message

In this step, we will define to send a filter user defined message from Component 1 when the Click event occurs on the Region group by field in the table, and make Component 2 receive the message and filter on the Region field once it receives the message.

To define to send a filter user defined message on Component 1:

  1. Right-click the group by field Region and click Send Message > Customize on the shortcut menu to bring out the Send Message dialog.
  2. In the Events box, check Click as the trigger event, then click on the event to activate the message options on the right.
  3. From the Message drop-down list, select User Defined, then input 1001 and Filter - Region as the message ID and name.
  4. Click to add a message line.
  5. Select the <Input> item from the drop-down list in the Key column and input Region in the text box.
  6. Select Current Value from the drop-down list in the Value column. String is dispalyed automatically in the Data Type column.

    The message is defined as follows:

  7. Click OK in the dialog to finish defining the message.

To make Component 2 receive the message and filter the Region field:

  1. Right-click the crosstab and select Receive Message from the drop-down list to display the Receive Message dialog.
  2. Click to add a message line.
  3. Select the <Input> item from the drop-down list in the Message ID column, then input 1001 in the text box.
  4. Input Filter - Region in the text box of the Message Name column.
  5. Click the blank text box in the Actions column, then click that appears.

  6. In the Web Action List dialog, select *Filter and click OK to display the Filter dialog.
  7. Select Region from the Filter On drop-down list, keep the default operator, then select <Input> under the Message Key node in the Value drop-down list and input Region in the text box.

  8. Click OK to go back to the Receive Message dialog. The message Component 2 receives is defined as follows:

  9. Click the OK button to finish defining the message.

Publishing the library components

After defining how to deliver the message, save the two library components. Then, start JReport Server and publish the library components along with the catalog SampleReports.cat to the component library in JReport Server. For detailed steps about publishing resources from JReport Designer to JReport Server, see Publishing resources remotely.

Delivering the filter user defined message in a dashboard

When the two library components are inserted into a dashboard, when the Click event occurs on the Region group by field in the table, the message will be delivered between them, and the records in the crosstab will then be filtered according to the specified condition.

To deliver the message in a dashboard:

  1. Open the JReport Console page, select New Report > Dashboard in the Reports tab to create a dashboard.
  2. Open the Components panel and browse to the folder where the two library components are published.
  3. Drag and drop the two library components to the dashboard.

  4. Click the region APAC in the table in Component 1 to send out the message, then you can see how the crosstab in Component 2 is filtered after it receives the message.

  5. Turn to Page 7 and click EMEA in the table, then you can see the records about this region is displayed in the crosstab.

  6. You can also click other regions to see the records about each region.