BackPrevious Page Next PageNext

Example of Delivering a Message

This example demonstrates how to deliver a filter user defined message between two library components in order to synchronize the data components in them. It contains the following tasks:

Task 1: Create two library components

Task 2: Send out a filter user defined message from the chart

Task 3: Make the two data components receive the same message

Task 4: Publish the library components to JReport Server

Task 5: Deliver the message in a dashboard for data synchronization

Task 1: Create two library components

  1. Open the catalog file SampleReports.cat in <install_root>\Demo\Reports\SampleReports.
  2. Use the business view SaleStat in Data Source 1 to create two library components and save them as Component 1.lc and Component 2.lc.

    For Component 1, create a chart which displays in the clustered bar 2-D chart type, shows Assigned Region on X-Axis and Total Actual as Bar Length. For Component 2, create a crosstab using Order ID and Assigned Region respectively as the row and column fields, and Total Actual as the summary field. Apply the style Commercial to both of them.

Task 2: Send out a filter user defined message from the chart

In this task, we will send a filter user defined message from the chart in Component 1 when the Click event occurs on any legend entry value.

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

    The message is defined as follows:

    Send Message dialog

  8. Click OK to finish defining the message to be sent out.
  9. Save the library component.

Task 3: Make the two data components receive the same message

In this task we will make the chart and crosstab in the two library components receive the same filter message to filter on the Assigned Region values when they receive the message sent out from a chart legend entry.

  1. Right-click the chart platform and select Receive Message from the shortcut menu to display the Receive Message dialog.
  2. Click Add button 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 - Assigned Region in the text box of the Message Name column.
  5. Click the blank text box in the Actions column, then click Choose button that appears.

    Receive Message dialog

  6. In the Web Action List dialog, select *Filter and click OK to display the Filter dialog.
  7. Select Assigned 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 Assigned Region in the text box.

    Filter dialog

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

    Receive Message dialog

  9. Click OK, then save the library component.
  10. Open Component 2.lc.
  11. Right-click the crosstab and select Receive Message from the shortcut menu.
  12. In the Receive Message dialog, specify the message the crosstab is going to receive as shown above.
  13. Upon finishing defining the received message, save the library component.

Task 4: Publish the library components

Start JReport Server and publish the library components along with the catalog SampleReports.cat to the component library in JReport Server. For details about publishing resources from JReport Designer to JReport Server, see Publishing Resources Remotely.

Task 5: Deliver the message in a dashboard for data synchronization

  1. Open the JReport Console > Resources page, click New > Dashboard on the task bar. A blank dashboard is displayed in JDashboard.
  2. Open the Resources panel and browse to the folder where the two library components are published.
  3. Drag and drop the two library components to the dashboard.

    Components in dashboard

  4. Click Asia-Pacific in the chart legend to send out the message. The chart and the crosstab are both filtered to show data in the Asia-Pacific region only.

    Data in the Asia-Pacific region for chart and crosstab

  5. Click the Clear Filters button on the toolbar to clear the filter in both components.
  6. Click Europe, Middle East, Africa in the chart legend and the chart and crosstab are filtered based on this region now.

    Data in Europe, Middle East, and Africa for chart and crosstab

BackPrevious Page Next PageNext