Preface
The TIBCO Flogo for TIBCO BusinessWorks Developers series of articles aims to familiarize BusinessWorks developers with TIBCO Flogo in order to better utilize these complementary technologies. Each article is focused on a specific key common behavior or feature that is often used in a BusinessWorks project. It takes that common behavior and replicates that in Flogo.
Conditional
In this article, we will take a look at Conditional. There are multiple different types of conditional within BusinessWorks that are commonly used. We will touch on each of these.
To help us illustrate these conditionals, we will use a process or flow in each BW5, BW6/CE and Flogo. In this scenario, we have a process or flow that triggers once. When the process triggers, it initializes a set of data. The data includes the name of a customer, the membership points accrued by the customer and the current shopping cart total of the customer.
BW5
BW6/CE
Flogo
The use-case here is if the customer has a membership point that is more than 100,000, then a log needs to be printed that this is a VIP customer. This is handled as part of the condition applied to the execution path where if a VIP is detected, a LogVIP is executed. Otherwise, it will bypass the logging.
BW5 - Execution Path Condition
BW6/CE - Execution Path Condition
Flogo - Execution Path Condition
Past the execution path condition, another mapper is always executed. Inside this mapper we have two types of inline conditionals. One of the conditions is an if statement where if the customer has a membership point of more than 200,000, a box of chocolate will be offered as a reward.
The other conditional statement is a choice condition. In this choice condition, it implements the logic where if the customer has more than 100,000 membership points, the total cost of the shopping cart will be reduced by 50%. If the customer has membership points between 50,000 and 100,000, the total cost of the shopping cart will be reduced by 10%. Otherwise, the total cost of the shopping cart will be unchanged.
BW5 - If and Choice Condition
BW6/CE - If and Choice Condition
Flogo - If and Choice Condition
Although the If condition in BW is implemented also as a If condition in Flogo, the Choice condition is implemented slightly differently. The Choice condition is implemented as a If, Else-If and Else in Flogo as shown.
When the project is run to completion, the last activity prints out the InitialData and MappedData. Given that the logic is implemented to be exactly the same in BW5, BW6/CE and Flogo, we would expect the result to also be the same. Below is the output from each.
BW5
BW6/CE
Flogo
All three projects coded in BW 5.15.1, BWCE 2.9.1 and Flogo 2.25.0 using the Visual Studio Code Extension are provided below for your reference.
BW_5_15_1-F4BWDev-Conditional.zip BWCE_2_9_1-F4BWDev-Conditional.zip F4BWDev-Conditional.flogo
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now