Jump to content
The TIBCO Platform is a real-time, composable data platform that will bring together an evolving set of your TIBCO solutions - and it's available now! See more information here ×
  • TIBCO Flogo for TIBCO BusinessWorks Developers - Conditional


    JenVay Chong

    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

    AD_4nXernrzYJOy-dqTIJNllVVgbhWwU_PtI7mVD77BG3Na10asrajloupIwDbea2pOIfHbaG_un1i1jPGa-ptbOdm63hA_Ig2VSh4Nqg2X5UmXlaygEmgcQIt8WqrZMeVwSosaahI8-QB1667dtVLzqlcwaLmA?key=BW_RB_rjugdYUHe5QItKHw

    BW6/CE

    AD_4nXemDXU3cLruhA_MdYTzXZUptdpmUxGtZ2Q2QkooN6JHq1d_KQEX9wBlk2ahmUg4HKbQd9KtbJ75sBu6MSMi1CBpsdkOAfmTfU7UbQrq5DpQS1XL0p-RojqHgoithnFflP3NerjA-rS90Q-Xrz7IMmCBMzDE?key=BW_RB_rjugdYUHe5QItKHw

    Flogo

    AD_4nXdTBZ5HZ1UnwyRYN7-vegZjSAmXccHBLgYg7OKNbq3Y1vTM0iS0_qOjhsjREovrvOO49817UsAsfOzFynHozb_3QjGtkobiCfEQIBG2WeJ7tT-NEx-43Q-2sHzw11smfKV2PFkO86EpMBTLupusPWVI19g?key=BW_RB_rjugdYUHe5QItKHw

    AD_4nXdhxwcLrIPouG8OH9X0-WddVGtxR6eKPpM3lctVVflHmSksQO279TAsI0B6JrbFjICvjjctKz-gdvKclfbKaX6rtyNKz9QQa0W1YnDiC_JA9Qz_e29TmhJD1XS0scZPtg5FiOJL9dlNETJEDGr5p6Uggw7V?key=BW_RB_rjugdYUHe5QItKHw

    AD_4nXc3diqngvK0JmexdqnPdbj9Ujz4QtAZKWDLuTQLViLnFdlqLm_beKC1yS6lvt2U5QiU_A7srfiquvC2k4T0Pp7AWAI-vvz-64ebGTFcc8SVq6zwlrcUor5CNICsE7svv5VwmxLCrgB5eKBDjN7EuhCDBQQe?key=BW_RB_rjugdYUHe5QItKHw

    AD_4nXcKHQFw82JWQ4Q4hfFH_TRaJvpYir5-sIrz2WhsXtpKeddEhIe00ehY9ADvZrqtqvHyYzZ-GP_aBQgiw7yArsx_EZG8bgu7v3KFyjGGNhnH0lToATtj5fNYqzSDRfZWSw98a7nQp7ND19Da5l_2o03spZYf?key=BW_RB_rjugdYUHe5QItKHw

    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

    AD_4nXcbbDAWay06IEXMTGCojxlLrXkbLAVphEpf8uJ7yoKMo2fB20rK7TPGcn8k8ByBuWM93Ee_eBtW2qyBYgIuW9L6ok8zoFfpoc2BIrgTYiKz5Wg_Mur0Vbha-ykHNCqn18KtVdt-jgPGOQ7sySO6D0bTc0kF?key=BW_RB_rjugdYUHe5QItKHw

    BW6/CE - Execution Path Condition

    AD_4nXfoaYc0Vb24GqYPnZ_yXPEqUoNVy3pFwBtALSU6P7d-xjjw66gpkJJzw9MhvqXUhAM1Ii4tg8FL7dfdwj1kp3gLXTvuwT7OGEbvLWxzLfd6xt65RE4ATFM7jzW3Up_WFP8bGpSFcbHh8lwLXB27hQ21HHBu?key=BW_RB_rjugdYUHe5QItKHw

    Flogo - Execution Path Condition

    AD_4nXcm0gDw2HOuRSY271lFNXIDs6eRE9a--ybrQuaK6rqP4zGEIi6M32DNVT5-l4lU3prx-TbAYJenjcKCZD86QzxSpW8-PO1ZEgXi7-zc-UGC1vNLJ9TQ3UsJtblzv2kFFFED6Knd7DdL5qy2wuIcJJkReH1m?key=BW_RB_rjugdYUHe5QItKHw

     

    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

    AD_4nXcGLsfRkxy4Hry1dSMzqWi0tXfNFav2d3JInPcSBnQQtWlspTsnqfoXeFg-605gON_qa6qvvvrfzQRQFXGLOEmYVDbD4-GsXahL8ksUJ_77iJegtxKlQo0f_d2j5eZkCcCzBQt4Gpu2auEERIooP1SORFS-?key=BW_RB_rjugdYUHe5QItKHw

    BW6/CE - If and Choice Condition

    AD_4nXd4leYD0LsJsvogugokxkgHbFJE3CrLFF5gARe1Xd5qGZLi2N1iP-wUV6dY8blOI1uUkJtmrA62zV4cmU-OTXYLBRwWjG9Nq5eoHB5tMaYFKu1xpv7rx4VaHktcaaME2u_gCueAy9u9B4EYiJQF7HABNLgB?key=BW_RB_rjugdYUHe5QItKHw

    Flogo - If and Choice Condition

    AD_4nXe2sU76d_q-a2w8E2DMPgi97R15fdM1WE8_qymN_Qw1o1icvAf70wznnCwe3cyw7QwRIHtqk2tQ58Br-UOiWVtRyf1EIdm9Hx4Ws5eI7gdI4-EluLFNpa5gt4qqjt2MWnZxmjwJD676_NU94LbT4Nzv53PM?key=BW_RB_rjugdYUHe5QItKHw

     

    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

    AD_4nXcEdOjDofb2dWoIf4NZdve2iLLbdEX7UGGJ1ZZOS7EZWh_qAjd6lDOJUPOvOCwxHoYJipAgyvOHqYitpBw6w3NZf92b7y2ijr4BPiEPxLvtwrQb6u9Rm-E2ooiRKyVA0VufDA2iYebXHxmWeZWcwLl3xh37?key=BW_RB_rjugdYUHe5QItKHw

    BW6/CE

    AD_4nXd_AzXbVvtZQHxm6JHx1nABrmoniaJsHdTkN6USqDWDmeO6woq4sUOgNGJBr4XIxtJvkqRiVI4jo3BdWIbML8J1LdyoSXbDfmWyF8EwFYHf6P8ZteYz6Ay54Dbiek8VdOIMfOva3D4l42a07N78E1k4FdsV?key=BW_RB_rjugdYUHe5QItKHw

    Flogo

    AD_4nXd7cYpvHPtQr-GVEIeesBGqb_kch5oK2yQI7h4KSsLa9JM4ieHq0oc87yffKXo6f2JLBWeozuHk_S9gdywMcStFeCS9bBi_0ZskRNGyxVafKM5bwe_R7W-zZYNaLX2XbIKMD4BRLMkmxCEaCLY5rP8VV484?key=BW_RB_rjugdYUHe5QItKHw

     

    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


    User Feedback

    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...