Note : this article uses an example from the standard Tutorial Demo Database.
In this example, we have a "Hotel" database and another database named "Datamart".
We have a process which takes a CustomerId parameter as input, and we want to execute different subprocesses depending on the Customer data.
The condition for checking if a Customer is VIP or Standard is based on data from two different databases.
The first data is located in HOTEL_DATAMART.DIM_CUSTOMER table:
The second data is located in HOTEL.T_BDR_PLN_CUS table:
Because these data are located in different databases, we cannot get them from a single Query.
So we create two "Sql To Parameters" Actions in order to get the values for the requested Customer.
Code for the "Sql To Parameters" :
<sqlToParameters>
<parameter name="../isVip" type="Integer" defaultValue="0">
select CUS_VIP
from HOTEL_DATAMART.DIM_CUSTOMER
where CUS_ID = ${../CustomerId}$
</parameter>
</sqlToParameters>
Code for "Sql To Parameters (2)" :
<sqlToParameters>
<parameter name="../maxPersCount" type="Integer" defaultValue="0">
select MAX(PLN_CUS_PERS_COUNT)
from HOTEL_MANAGEMENT.T_BDR_PLN_CUS
where CUS_ID = ${../CustomerId}$
</parameter>
</sqlToParameters>
And then we add an Execution Condition on the Links in order to trigger "VIP User" or "Standard User" depending on the values.
The test condition for the link to "VIP User" is:
${isVip}$ == 1 && ${maxPersCount}$ > 5
The test condition for the link to "Standard User" is simply the negation of the the same condition:
!( ${isVip}$ == 1 && ${maxPersCount}$ > 5 )
When executing the process :
- Both "Sql To Parameters" are executed in parallel
- The EmptyAction waits for them to finish
- Note : The Variable view shows the result of Sql To Parameters
- After the EmptyAction has been reached, the Runtime checks the Execution Condition of both Links
- In this example the condition is not met (maxPersCount is not > 5) => The "Standard User" subprocess is triggered.