Receiving a built-in message
At runtime, when a data component in a library component receives the built-in message 0001 - Filter, 0002 - Sort, 0003 - Parameter or 0004 - Parameters, it will filter, sort itself based on conditions defined in the message, or re-run the library component using the parameter values the message specifies.
This document shows how to make a data component receive a built-in message in detail.
To receive the built-in message 0001 - Filter:
- Select a table, chart, crosstab or geographic map in a library component, right-click the mouse button and select Receive Message from the shortcut menu to display the Receive Message dialog. See the dialog.
- Click to add a message line.
- Select the built-in message 0001 - Filter from the drop-down list of the Message ID column. The filter condition defined in the message will be automatically applied.
- If you want to edit the filter condition, click in the Actions column and click that appears in the text box to open the Filter dialog. See the dialog.
- Specify the filter condition by selecting the field on which the filter will be based from the Filter On drop-down list, the operator to compose the condition from the Operator
drop-down list and the value of how to filter the field from the Value drop-down list.
- If necessary, specify And or Or in the More column so as to add a new filter condition or you can click to add a new filter condition.
To delete a filter condition, select the condition and click . To adjust the order of the filter conditions, click or .
- Click OK to finish defining the filter conditions.
- Click OK in the Receive Message dialog. Then at runtime, when the data component receives the message, it will filter itself based on the predefined conditions.
To receive the built-in message 0002 - Sort:
- Repeat steps 1 and 2 in the above procedure.
- Select the built-in message 0002 - Sort from the drop-down list of the Message ID column. The sort conditions defined in the message will be automatically applied.
- If you want to edit the sort condition, click in the Actions column and click that appears in the text box to open the Sort dialog. See the dialog.
- Specify the sort condition by selecting the field on which to sort the records from the Sort On drop-down list, and in which order to sort the records from the Sort Value drop-down list.
- If necessary, click to add a new sort condition.
To delete a sort condition, select the condition and click . To adjust the order of the sort conditions, click or .
- Click OK to finish defining the sort conditions.
- Click OK in the Receive Message dialog. Then at runtime, when the data component receives the message, it will sort itself based on the predefined conditions.
To receive the built-in message 0003 - Parameter:
- Repeat steps 1 and 2 in the above procedure.
- Select the built-in message 0003 - Parameter from the drop-down list of the Message ID column. The parameter value defined in the message will be automatically applied.
- If you want to edit the parameter, click in the Actions column and click that appears in the text box to open the Parameter dialog. See the dialog.
- Specify the parameter and the value of the parameter from the Parameter Name and Value drop-down lists. The operator can only be =.
- Click OK to accept the settings. Then at runtime, when the data component receives the message, the library component which contains it will be re-run, using the predefined parameter value.
To receive the built-in message 0004 - Parameters:
- Repeat steps 1 and 2 in the above procedure.
- Select the built-in message 0004 - Parameters from the drop-down list of the Message ID column. The parameter values defined in the sent message will be automatically applied.
- If you want to edit the parameters, click in the Actions column and click that appears in the text box to open the Parameter dialog. See the dialog.
- Specify the parameter and the value of the parameter from the Parameter Name and Value drop-down lists. The operator can only be =.
Parameter Name* in the Parameter Name drop-down list means all parameters defined in the message will be used to re-run the library component, and its corresponding value can only be Parameter Value* that represents all parameter values.
- Click to add a new parameter line and specify the parameter and value as you want.
To delete a parameter line, select it and click . To adjust the order of the parameters, click or .
- Click OK to accept the settings. Then at runtime, when the data component receives the message, the library component which contains it will be re-run, using all the predefined parameter values.
See also Filter dialog, Sort dialog, Parameter dialog for additional information about options in the dialog.
Note: In the drop-down lists for editing the conditions to respond a message, you may find that some items have the icon ahead of them and they are listed under the Message Key node. If you choose an item of this type, it means the item will not be used directly in a condition, instead, it will be mapped to a key in the message and JReport will find the value that is specified to the key from the message first and then use that value to compose the condition.