The Parameter processor retrieves parameters from one input and applies them to another flow. This allows flows to be developed and reused with different sets of parameters and for parameters to be maintained independent of the flows.
To understand the interaction of parameters, we need to understand the sequence of a flow. When we want to view data from a Result, the request is sent from the Result back up the flow to the source or sources. The source(s) then push the records back down the flow to the Result. The Parameter processor intercepts the original request as it travels up the flow and inserts the necessary parameter values. These are then available to processors further up the flow (towards the source). With this understanding we can see that Parameter processors are often used close to the Result-end of the flow, so that they can propagate parameters to all upstream processors.
Properties
The Parameter properties are shown in Figure 4.33, “Parameter Wizard”.
Let us filter records based on a parameter which is read from a different datasource:
Create a Properties DataSource named SampleProperty
.
Click Add Column and in the dialog enter
field Name as FruitChoice
, Data Type as String and
the Value as Orange. Click the OK button. The
column is added to the DataSource. Similarly any
number of fields can be added. After adding the
fields the DataSource Wizard appears as shown in
Figure 4.34, “Completed Properties DataSource”. Click the Finish button. (For more
information on working with Properties DataSource
refer to Chapter 8, Properties DataSource.)
Add a Tabular DataSource SampleFruit
which
includes a column listing each fruit name.
Drag and drop SampleFruit
onto the Composite diagram.
Place a Filter on the diagram and use a Flow to connect SampleFruit DataSource processor to the Filter processor.
Invoke the Filter Properties and in the Filter#1 tab select Matches from the When combo box in the Fruit row. Enter condition as ${FruitChoice} where ${FruitChoice} is the dynamic parameter we will get from the Properties datasource. For more information on dynamic parameters refer to Appendix A, Dynamic Parameters.
Click the Finish button.
Place a Parameter processor on the diagram.
Connect the Filter output to the data input of the parameter processor.
Drag and drop the SampleProperty
onto
the diagram.
Connect the SampleProperty data source with the
params
input of the Parameter processor.
Finally, connect the output of the Parameter processor to the Result. The diagram appears as shown in Figure 4.35, “Sample Parameter Flow”.
Select Result and choose View from the popup menu. The output is shown in Figure 4.36, “Parameter Result”. As the Value of FruitChoice in the property DataSource is Orange the records corresponding to Orange are fetched.