<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Diorella Mari Tom on Medium]]></title>
        <description><![CDATA[Stories by Diorella Mari Tom on Medium]]></description>
        <link>https://medium.com/@diorellatom?source=rss-baf09048c9c4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*3WaJpIGMhh9E269MVl1ksg.jpeg</url>
            <title>Stories by Diorella Mari Tom on Medium</title>
            <link>https://medium.com/@diorellatom?source=rss-baf09048c9c4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 23:57:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@diorellatom/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[IBM Business Automation Workflow Using IBM Operational Decision Manager Decision Service]]></title>
            <link>https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-using-ibm-operational-decision-manager-decision-service-19adc0e541f4?source=rss-baf09048c9c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/19adc0e541f4</guid>
            <category><![CDATA[odm]]></category>
            <category><![CDATA[decision-service]]></category>
            <category><![CDATA[baw]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[workflow]]></category>
            <dc:creator><![CDATA[Diorella Mari Tom]]></dc:creator>
            <pubDate>Tue, 07 Jul 2020 09:01:03 GMT</pubDate>
            <atom:updated>2020-08-19T08:59:47.534Z</atom:updated>
            <content:encoded><![CDATA[<p>Demonstrates how you can discover and use the IBM Operational Decision Manager decision service in IBM Business Automation Workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*GeC-Z9UF57vV_xhL_R1cNw.jpeg" /><figcaption><a href="https://www.123rf.com/profile_rastudio">rastudio</a> © <a href="http://www.123rf.com/">123RF.com</a></figcaption></figure><h3>Code Repository</h3><p>Examples can be found in the <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk">TipsforBAW Toolkit</a> Github repository.</p><h3>Introduction</h3><p>IBM Business Automation Workflow (BAW) and Operational Decision Management (ODM) solutions are naturally complementary because every transaction, order, customer interaction depends on decisions. The combination of workflow and decision brings additional flexibility, agility, and availability to the business and technical experts when building processes. In a separate posting, which is <a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-implementing-decision-tasks-5f2d8e9dbd38">IBM Business Automation Workflow Implementing Decision Tasks</a>, we show the capability of IBM BAW to create and use decision tasks in a workflow by implementing the decision logic in action rules or decision tables. In most cases, we can develop and implement business rules in IBM BAW processes and service flows. However, there are situations where you need to use the decision logic beyond your workflow application like:</p><ul><li>Business rule complexity exceeds what it supports within IBM Business Automation Workflow</li><li>Business rules are continuously changing</li><li>Business rules need to modify in real-time</li></ul><p>In these situations, we need the extensive decision automation capability of IBM Operational Decision Manager to manage decisions separately from the business application, with more flexibility and responsiveness to the changing needs of the business.</p><p>The transition of business rules/decisions in a workflow application and moving to them into a decision management system provides some benefits:</p><ul><li>Rules development and maintenance are more effective.</li><li>Changes to the business rules do not require changes to your workflow application or process codes.</li><li>Business experts can define and manage decisions with limited dependence on IT.</li><li>Your application can remain up to date and aligned and meet changing business needs quickly.</li><li>You can share and reuse business rules/decisions across applications and platforms.</li></ul><p>This article provides the following detailed information on discovering and using IBM Operational Decision Manager decision service in IBM Business Automation Workflow. It makes our business process more efficient, resilient to change, and accessible to enable the business to respond to the evolving requirements.</p><ol><li>Export Rules from BAW and Import them into ODM Rule Designer.</li><li>Retrieve the Hosted Transparent Decision Service in ODM Rule Execution Server</li><li>Invoke ODM Decision Service from BAW</li></ol><h3>Export Rules from BAW and Import them into ODM Rule Designer</h3><p>One feature of IBM Business Automation Workflow (BAW) is to implement a decision task which discussed in the previous article, <a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-implementing-decision-tasks-5f2d8e9dbd38">IBM Business Automation Workflow Implementing Decision Tasks</a>. When you need to define your decision logic outside your workflow application, IBM BAW allows you to export the set of action rules and/or decision tables in your decision task and then import them into Rule Designer. IBM Operation Decision Manager (ODM) enhances your rules and adds the ability for business users to create, update, and deploy the business rules and to have a single set of rules available to multiple applications.</p><p>This section provides detailed steps on how you can export the rules from a decision task in IBM BAW and how you can import the rules in IBM ODM Rule Designer. To complete the steps below, we will export the rules of ‘ValidateLoyaltyRewards’ service flow created in the previous article.</p><h4>Step 1: Export the Rules to a Project File</h4><ul><li>In Process Designer, select the Service Flow that contains the decision that you want to export.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NVmJF1A51uG2y7p-wGJx9Q.jpeg" /><figcaption>Figure 1: ValidateLoyaltyRewards Service Flow</figcaption></figure><ul><li>In the service flow, select the <strong>Decisions</strong> tab, then on the left pane, select the <strong>decision name</strong> you want to export. Click <strong>Export</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F05rMaxD9Drpt5DItnrCOQ.jpeg" /><figcaption>Figure 2: Export Action Rule and Decision Table</figcaption></figure><ul><li>The rule project file is automatically downloaded and saved on the location specified in your browser settings, see Figure 3. In case your browser is configured to ask where to save each file before downloading, navigate to the location where you want to save the exported rule project then enter the filename, see Figure 4. Click <strong>Save</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dm8A-bMmot1RRJMZpCa8Kg.jpeg" /><figcaption>Figure 3: The exported file is automatically downloaded</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vk6sudCogO9ZcgURuRd_GQ.jpeg" /><figcaption>Figure 4: ‘Save As’ Window to export the project file</figcaption></figure><blockquote><strong>NOTE: </strong>The export procedure produces a complete rule project suitable for maintaining and continuing the work in IBM Operational Decision Manager Rule Designer.</blockquote><h4>Step 2: Import the Rule Project File in Rule Designer</h4><ul><li>Open the Rule Designer then select an empty workspace. Click <strong>OK</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*Kh4bLLMGCoKqtV_gfk8xFw.jpeg" /><figcaption>Figure 5: Rule Workspace</figcaption></figure><ul><li>In Rule Explorer, import your rule project file. There are two ways to import:</li></ul><ol><li>Click <strong>File</strong> &gt; <strong>Import</strong> &gt; <strong>General</strong> &gt; <strong>Existing Projects into Workspace</strong> then click <strong>Next</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0xnj7YUUMr0i60Xcym8HJA.gif" /><figcaption>Figure 6: Import Project File</figcaption></figure><p>2. Right-click on your workspace, then select import&gt; <strong>Existing Projects into Workspace,</strong> then click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2boiudzVoVwM2wT8DqknRA.gif" /><figcaption>Figure 7: Import Project File</figcaption></figure><ul><li>In the <strong>Import Projects</strong> window, click <strong>Select archive file</strong>. Click <strong>Browse</strong> then navigate to the location where you saved the exported the rule project and select the file, as shown in Figure 8.</li><li>Select the project that will be imported, then click <strong>Finish</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rk1SKct0bGZUqmSA2N4K0Q.gif" /><figcaption>Figure 8: Select archive file to import</figcaption></figure><ul><li>The imported rule project file consists of the following rule artifacts, see Figure 9.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*9i84Hn8S9h9zJgHhFMJ3fg.jpeg" /><figcaption>Figure 9: Imported Rule Artifacts</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vUSwakki75_yOpIzP3wyGw.jpeg" /><figcaption>Figure 10: IBM BAW Decisions transformed into IBM ODM Rule Artifacts</figcaption></figure><p>After exporting the action rule and decision table and importing them into Rule Designer, the ODM Developer can now develop and update the rule artifacts depending on the user requirements and deploy them on a Rule Execution Server (RES).</p><h3>Retrieve the Hosted Transparent Decision Service in ODM Rule Execution Server</h3><p>You can now retrieve the Hosted Transparent Decision Service (HTDS) once you deployed the decision service to the Rule Execution Server (RES). A hosted transparent decision service (HTDS) is an execution component linked to a ruleset path. Using HTDS, you can invoke a deployed ruleset as a web service (WSDL) or REST API. You can generate OpenAPI representations for executing decision services. OpenAPI is a standardized version of the Swagger specification that provides a language-independent way to present REST APIs.</p><blockquote><strong>NOTE:</strong> You cannot generate an OpenAPI specification if the ruleset uses an XML Schema Definition (XSD) as its execution object model (XOM) instead, use a web service WSDL specification and call it from IBM BAW as a web service.</blockquote><p>This section shows you the procedure to download the OpenAPI specification for the service that you will use to discover the IBM ODM decision service as an external REST service. For this example, I use the ‘Customer Loyalty Program’ decision service, which is the enhanced version of the exported rules from the previous section.</p><ul><li>Login to Rule Execution Server console then navigates to the Ruleset View of the project you want to use, as shown in Figure 11.</li></ul><ol><li>Click <strong>Explorer </strong>where you can browse the deployed RuleApps.</li><li>In RuleApps View, click <strong>CustomerLoyaltyProgram </strong>RuleApp.</li><li>In RuleApp View, click the ruleset <strong>Cusomer_Loyalty_ProgramRuleset</strong>.</li></ol><ul><li>On the upper right corner of the Ruleset View, click <strong>Retrieve HTDS Description File</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CpsT0rUaxaxmKiPe1vOExg.gif" /><figcaption>Figure 11: Navigating to Retrieve HTDS Description File</figcaption></figure><ul><li>Select <strong>REST</strong> for the service protocol type then select <strong>OpenAPI — JSON</strong> for the Format. Choose the <strong>Latest ruleset version</strong> and <strong>Latest RuleApp version</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*mZlDSAYnLlCr5MjSRTSR8w.jpeg" /><figcaption>Figure 12: Retrieve HTDS Description File</figcaption></figure><ul><li>Click <strong>Download</strong> to save the file locally or click <strong>View</strong> and copy the URL.</li></ul><p>The sample <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk/blob/master/using-odm-decision-service/CustomerLoyaltyProgramCustomer_Loyalty_ProgramRulesetDecisionService.json">OpenAPI Specification file</a> (JSON format)is available in TipsforBAW Toolkit stored in the Github repository.</p><blockquote><strong>NOTE:</strong> If your ruleset is secured, you must add the <em>security=basic</em> option to the URL so that Business Automation Workflow sends the security credentials to the OpenAPI specification with security definition.</blockquote><h3>Invoke ODM Decision Service from BAW</h3><p>Another way to integrate service in IBM Business Automation Workflow (BAW) is by using external services. With external services, you can call service on a system that is external to IBM BAW. It provides an interface where you can discover the service, select operations you want to use, and set a server containing the information required to invoke the service. The types of services available are Java service, a web service, or REST service.</p><p>In this section, we will discover a REST service from an OpenAPI Specification (formerly known as Swagger). After downloading the OpenAPI JSON format, we can now invoke the decision service provided by an Operational Decision Manager (ODM) instance. A Decision Service contains one or more rule project that implements the set of business rules and exposed as a web service or REST API. Using ODM Decision Service, you can integrate decision capabilities in Business Automation Workflow (BAW).</p><p>The example uses the enhanced Customer Loyalty Program from in the previous article, <a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-implementing-decision-tasks-5f2d8e9dbd38">IBM Business Automation Workflow Implementing Decision Tasks</a>. There are two steps to complete in discovering and using the ODM Decision Service in your workflow application.</p><ol><li>Create an External Service to Discover ODM Decision Service</li><li>Use the External Service in a Service Flow</li></ol><blockquote><strong>Best Practice: </strong>ODM Integration should be created in a toolkit so that the decision service is reusable by multiple applications. If you created the integration within the process application, then it will only be used within that process application.</blockquote><p>The example is available in the <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk/tree/master/using-odm-decision-service">ODM Integration Toolkit</a> stored in the GitHub repository.</p><h4>Step 1: Create an External Service to Discover ODM Decision Service</h4><ul><li>In the ODM Integration Toolkit navigator, go to <strong>Services</strong> and then click the plus icon (<strong>+</strong>) to create a new <strong>External Service,</strong> as shown in Figure 13.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*-sfvs3zakFyF_I0IrJiVfA.jpeg" /><figcaption>Figure 13: Services &gt; External Service</figcaption></figure><ul><li>In the New External Service window, select <strong>Java, REST or Web service</strong> and then click <strong>Next</strong>, see Figure 14.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*0l6GBqrnKxTRQTlgxwzpiw.jpeg" /><figcaption>Figure 14: New External Service</figcaption></figure><ul><li>Select a method to discover your decision service from the following:</li></ul><ol><li><strong>REST service from a local file</strong> — select an OpenAPI (Swagger) file on your local file system.</li><li><strong>REST service from URL</strong> — enter the URL of the OpenAPI (Swagger) file.</li><li><strong>Web service from Web Service Server</strong> — select the server you created for the web service.</li><li><strong>Web service from URL</strong> — enter the URL of the web service definition language (WSDL) file.</li><li><strong>Java service from Server File</strong> — select the Java archive (jar) file in the server file.</li></ol><p>Since we downloaded an OpenAPI Specification (Swagger) file in the previous section, we will select <strong>REST service from the local file</strong> and then browse to select the OpenAPI (Swagger) file on your local file system as shown in Figure 15.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*KL4bTBAGsWp0GU-C2V-d1w.gif" /><figcaption>Figure 15: Discover Service via REST service from local file</figcaption></figure><ul><li>In the list of discovered operation/s, select the operation/s you want to include in the external service and then click <strong>Next</strong>, see Figure 16.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*Rp4Ck-c-Of53qfxU9HdVtQ.jpeg" /><figcaption>Figure 16: List of Discovered Operations</figcaption></figure><ul><li>Set the server that contains the properties used to invoke the REST service. Select <strong>Create a new server</strong> and click <strong>Finish</strong>, see Figure 17.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*g8JtGqkk1bODQTZ8b2Pw6g.jpeg" /><figcaption>Figure 17: Create New Server</figcaption></figure><ul><li>Once done creating the external service, check the generated artifacts: several business objects and an external service, as shown in Figure 18.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*55xDZZ30DKAmirlkInh6gw.jpeg" /><figcaption>Figure 18: Customer Loyalty Program External Service</figcaption></figure><ul><li>To verify the configured server, go to Toolkit Settings &gt; Server and check the server details, see Figure 19.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cP7ES70jPYgU6CQfZMapkQ.jpeg" /><figcaption>Figure 19: Server Details</figcaption></figure><blockquote><strong>Reminder:</strong> From the Servers tab, you can add server configurations for Development, Test, Staging, and Production environments so you can connect to the ODM Rule Execution Server instance of the respective environments. Click the plus icon (+) to add a new server configuration, see Figure 20.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CXRwH6o0RAG2jBHQ-aJ_EA.jpeg" /><figcaption>Figure 20: Add Server Configurations</figcaption></figure><p>Now, we will define BAW services to use ODM Decision Service integration.</p><h4>Step 2: Use the External Service in a Service Flow</h4><ul><li>In the ODM Integration Toolkit navigator, go to <strong>Services</strong> and then click the plus icon (<strong>+</strong>) to create a new <strong>Service Flow,</strong> as shown in Figure 21.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*kc8bmLbN2D3D5Qme_knuFQ.jpeg" /><figcaption>Figure 21: Services &gt; Service Flow</figcaption></figure><ul><li>Enter the name of the service and click <strong>Finish</strong>, see Figure 22.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*IaLvHUxE302tnXyaIX41bQ.jpeg" /><figcaption>Figure 22: Create Service Flow</figcaption></figure><ul><li>Drag into the diagram the created external service and change the name of the service task, as shown in Figure 23.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SXhpELXZZi08btB_dpLLlw.gif" /><figcaption>Figure 23: Add External Service in the Service Flow</figcaption></figure><ul><li>Set the Implementation by clicking <strong>Validate and Determine Rewards </strong>service task and under Properties, click <strong>Implementation</strong>. Select the operation using the dropdown, see Figure 24.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9gO4MGRMfJR0reBtC9n_PA.jpeg" /><figcaption>Figure 24: Service Operation</figcaption></figure><ul><li>Set the Data Mapping of <strong>Validate and Determine Rewards</strong>. Under Properties &gt; <strong>Data Mapping</strong>, set the input and output mapping using the <strong>auto-map,</strong> as shown in Figure 25. It will create private variables for input and output.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1o-YCBF09S_RzcI6_oN67w.gif" /><figcaption>Figure 25: Data Mapping</figcaption></figure><ul><li>Check the created private variables in the <strong>Variables</strong> tab and expand each variable. The Request variable has two parameters that the ODM Decision Service needs as input, see Figure 26.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*WCAolap53fof80ZWUseSLw.jpeg" /><figcaption>Figure 26: Service Variables</figcaption></figure><blockquote><strong>NOTE: </strong>DecisionID parameter is optional which can be used for tracking purposes. Rule Execution Server generates a unique ID when the ID is not specified. DecisionID is used to identify the transparent decision service that your request defines. If you want to provide a DecisionID, make sure that the ID is unique to avoid conflicts with the element/s implemented in Rule Execution Server.</blockquote><ul><li>Define input and output variables for <strong>Validate and Determine Rewards ODM </strong>service flow to be able to invoke the service, see Figure 27. Your input and output variables will depend on the Request and Response of your decision service operation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*Dz3OVEjmBeBywMyRonv0nw.jpeg" /><figcaption>Figure 27: Input and Output Variables</figcaption></figure><ul><li>Map the input and output variables to the Request that used to call the actual ODM service. Add <strong>Server Script</strong> components to the diagram and then wire them all together, as shown in Figure 28. <strong>Set Data</strong> script component will set the input variable to the Request, while the <strong>Get Data</strong> script component will set the Response to the output variable.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sPXkW_zdMyaG2QpHunjalw.jpeg" /><figcaption>Figure 28: Server Script Components</figcaption></figure><p>Once done creating the service flow, take a snapshot of your toolkit and then add the toolkit to your process application so you can invoke this service. Now, let’s run our sample implementation by opening the <strong>Using ODM Decision Service Example</strong> CSHS in TipsForBAW Toolkit.</p><blockquote>Before you test the example, make sure that the Customer Loyalty Program RuleApp is deployed in ODM Rule Execution Server. The sample RuleApp is also available in <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk">TipsforBAW Toolkit</a> stored in the GitHub repository.</blockquote><p>In the Customer Information, enter the <strong>Amount Spent in the last two years</strong> and click <strong>Validate</strong>. It should display the corresponding <strong>Discount</strong>, <strong>Loyalty Type,</strong> and <strong>Additional Rewards Offer</strong> based on the rule definitions, see Figure 29.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*EA96qwem4ol9s42dWbeuDQ.gif" /><figcaption>Figure 29: Using ODM Decision Service Example</figcaption></figure><h3>Summary</h3><p>This article has explored the ways to optimize business activity using Business Automation Workflow (BAW) and Operational Decision Manager (ODM) and demonstrated how to externalize rules and manage them in IBM ODM. The following are the criteria to consider using IBM ODM as part of your IBM BAW solution:</p><ul><li>Complexity — Since IBM BAW based rules are better at handling simple rules, IBM ODM provides the rule orchestrations, which gives a robust set of capabilities to design and deploy a complete decision management solution.</li><li>Agility and Flexibility — This benefits the business by managing decision services separate from the workflow development that allows the business to change the rules without changing your process application and codes and enables the business to deal with the changing business needs.</li><li>Reusability and Consistency — Using ODM decision services, clients can maintain the rules as a shared component that ensures all applications and platforms implementing decisions use the same set of rules.</li><li>Business and IT Collaboration — With ODM decision services, business users and IT teams can work together on defining and managing the lifecycle of rules. It allows business users to access, review, and update rules. At the same time, the IT team can be advisors to the business users to ensure the correctness of the rules and can support them on rule governance for the decision operations.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19adc0e541f4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-using-ibm-operational-decision-manager-decision-service-19adc0e541f4">IBM Business Automation Workflow Using IBM Operational Decision Manager Decision Service</a> was originally published in <a href="https://medium.com/ibm-business-automation-ap-el">IBM Digital Business Automation Tips and Assets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IBM Business Automation Workflow Implementing Decision Tasks]]></title>
            <link>https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-implementing-decision-tasks-5f2d8e9dbd38?source=rss-baf09048c9c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f2d8e9dbd38</guid>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[baw]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[decision-task]]></category>
            <dc:creator><![CDATA[Diorella Mari Tom]]></dc:creator>
            <pubDate>Tue, 12 May 2020 09:01:00 GMT</pubDate>
            <atom:updated>2020-05-22T10:37:11.131Z</atom:updated>
            <content:encoded><![CDATA[<p>Adding decision task in a process or service flow and implementing the decision logic using an action rule or a decision table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*gsJTnprKcIBiI6nWsUx0wQ.jpeg" /><figcaption><a href="https://www.123rf.com/profile_radachynskyi">Serhii Radachynskyi</a> © <a href="http://www.123rf.com/">123RF.com</a></figcaption></figure><h3>Code Repository</h3><p>The examples can be found in the <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk">TipsforBAW Toolkit</a> Github Repository</p><h3>Introduction</h3><p>Processes have frequent need to make decisions and IBM Business Automation Workflow (BAW) has built in capabilities that can help to extract rules from code into decision tasks and decision services. This makes it easier to understand and maintain your decisions. For those familiar with IBM Operation Decision Manager (ODM) there is a lot of synergy in the approach, and the decision tables created in BAW can be exported to ODM. With this enhanced decision capability, it is recommended to adopt the decision tasks and services in our workflow to simplify and reduce the amount of decision code in a process.</p><p>Business rules such as action rules and decision tables are authoring components that use predefine business vocabulary that are easily readable by humans and can be interpreted by a computer. In this article, we will examine how to create and use decision tasks in a workflow by implementing the decision logic in action rules or decision tables.</p><p>Decision tasks are a convenient low-code way of representing decision logic. Some of the advantages of the decisions task include:</p><ul><li><strong>No Need to Code</strong> — you don’t have to write JavaScript code or even need a programmer/developer to implement business rules.</li><li><strong>Easy to Read</strong> — it uses natural language technology to express business rules in a form that is easy to read and understood by all.</li><li><strong>Easy to Modify</strong> — you can easily add, update and delete conditions/actions of the business rules when you use decision tables since it is presented in a table format.</li><li><strong>Easy to Identify Problems </strong>— it helps you to easily see or catch errors/problems such as overlaps, gaps, etc. in Decision Table and missing words, mismatch type, etc. in Action Rule.</li><li><strong>Reuse and Consistency </strong>— you can prevent a developer to create the same rules in JavaScript because the created decision task in a service flow can be called and reuse within your process application.</li></ul><p>For the remainder of this article, we will help to demonstrate these advantages by stepping through sample scenarios that present a business process and provides examples of the following:</p><ol><li>Using Decision Task</li><li>Implementing Decision Task in a Service Flow</li><li>Implementing Decision Service in a Process</li></ol><h3><strong>Using Decision Task</strong></h3><p>Decision task helps incorporate decision logic and business rules in your process application. During development, we should use Decision tasks in our service flows, to reduce coding and create reuse-able decision service flows.</p><h4>Business rule/decision</h4><p>As a developer, we need to know when a Decision Task is necessary to use. Let’s observe the example below, we have here a business rule/decision written as JavaScript code. The code snippet shows a script that determines the customer loyalty and rewards benefit based on the amount spent in the last 2 years.</p><pre>if (tw.local.amountSpent &gt; 350000) { <br>    tw.local.discount = 0.20;<br>    tw.local.loyaltyType = “Diamond”;</pre><pre>} else if (tw.local.amountSpent &gt; 200000 &amp;&amp;<br>           tw.local.amountSpent &lt; 350000) {<br>    tw.local.discount = 0.12;<br>    tw.local.loyaltyType = “Platinum”;<br> <br>} else if (tw.local.amountSpent &gt; 100000 &amp;&amp; <br>           tw.local.amountSpent &lt; 200000) {<br>    tw.local.discount = 0.10;<br>    tw.local.loyaltyType = “Gold”;</pre><pre>} else if (tw.local.amountSpent &gt; 50000 &amp;&amp; <br>           tw.local.amountSpent &lt; 100000) {<br>    tw.local.discount = 0.07;<br>    tw.local.loyaltyType = “Silver”;<br> <br>} else if (tw.local.amountSpent &gt; 25000 &amp;&amp; <br>           tw.local.amountSpent &lt; 50000) {<br>    tw.local.discount = 0.05;<br>    tw.local.loyaltyType = “Bronze”;<br> <br>} else if (tw.local.amountSpent &lt; 25000) {<br>    tw.local.discount = 0.025;<br>    tw.local.loyaltyType = “General”;<br>}</pre><p>One quickly notices the if-else statements, they have very similar and highly repetitive statements. They have the same number of conditions that need to be evaluated and same number of actions that must be performed. Each statement is checking for the amount spent in the last two years and will give the customer its discount percentage and type of loyalty. Decision tasks provide (Decision Tables and Action Rules) for us to simplify this coding and we should use a decision task to replace the code. <em>Figure 1</em>, implements the same business rules using a Decision Table. Notice that the decision table is easier to read and understand and more concise compare to the if-else statement JavaScript code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f12SbuyK4H2HFSlSSHSm7g.jpeg" /><figcaption>Figure 1: Decision Table Example</figcaption></figure><p>Lets now look at the detailed steps for the creation of Decision tasks.</p><h3><strong>Implementing Decision Task in a Service Flow</strong></h3><p>Implementing Decision task allows you to create rule-based decision using action rule or decision table. In this section, we provide detailed steps on how you add Decision task to a service flow and then add decision tables and/or action rules to the decision task. The business scenario represented is business rules that will validate and display the customer loyalty and rewards benefit based on the amount spent in the last 2years. This example walks through the steps on how to use decision task in displaying the customer’s loyalty and rewards program as seen here in <em>Figure 2</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eidkFB9Sjfjro7aA7JD4mw.jpeg" /><figcaption>Figure 2: Implementing Decision Task in a Service Flow Example</figcaption></figure><p>There are 3 steps to complete in adding decision task in a service flow:</p><ol><li>Create a Decision task in a Service Flow</li><li>Define Input and Output Variables</li><li>Add and Write the Rules in your Decision task (implemented as a Decision Table or Action Rule).</li></ol><p>The example is available in Decision Task in Process Example CSHS in the <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk">TipsForBAW Toolkit</a> stored in the GitHub repository.</p><h4><strong>Step 1: Create a Decision task in a Service Flow</strong></h4><p>Create ‘ValidateLoyaltyRewards’ service flow and then in the diagram, click the down arrow of the Activity icon on the component palette and then drag the decision icon as shown in Figure 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3wvP3nFkip8-ZXEh7PZmeQ.jpeg" /><figcaption>Figure 3: ValidateLoyaltyRewards Service Flow</figcaption></figure><p>Another way is to drag the Activity icon in the service flow diagram (default is Server Script) and then change the Activity Type in Implementation tab as shown in Figure 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nK9s7kKwbbjOlIqNKcq-dQ.jpeg" /><figcaption>Figure 4: Selecting Decision Activity Type</figcaption></figure><h4><strong>Step 2: Define Input and Output Variables</strong></h4><p>Click the Variables tab and define the following input and output variables of the Decision task in Figure 5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ka_xbOm6U7Yca-uJQar4LQ.jpeg" /><figcaption>Figure 5: Decision task Input and Output Variables</figcaption></figure><h4><strong>Step 3: Add and Write the Rules in your Decision task</strong></h4><p>This step shows you how to add and write the rules in our Decision task. There are two ways to write your business rules, one is <strong>Decision Table</strong> and the other is <strong>Action Rule</strong>. Decision table represent decision logic as a table while Action Rules are sentence-like statements.</p><p>You use a <strong>Decision Table</strong> when you have rules that has the same rule statement but have different conditions and actions otherwise use an <strong>Action Rule</strong> when you have rules that defines a specific action to take when a certain condition is met.</p><p>First, we will demonstrate the following steps on how to add a Decision Table to your Decision task and define the rules for your decision table.</p><h4><strong>Using Decision Table</strong></h4><p>Decision Tables contains rows and columns where each row corresponds to a rule statement. To add a decision table, follow the steps below:</p><ul><li>Open the decision editor by clicking the Decision tab or the ‘Open Decision’ in Implementation tab, see Figure 6.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4cRGxYm7RObEROUgshN7XA.jpeg" /><figcaption>Figure 6: Opening Decision Editor</figcaption></figure><ul><li>When the decision editor is open, it shows a basic rule template with one condition (<em>if</em>) and one action (<em>then</em>), see Figure 7.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lNfENA4dotMLrUBh7CM_RA.jpeg" /><figcaption>Figure 7: Basic Action Rule Template</figcaption></figure><ul><li>Since we are creating Decision Table, we need remove the Action Rule by clicking the ‘X’ button as shown in Figure 8, to delete that action rule.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*28Y_-mS-jsrvCsJuZjBQlw.jpeg" /><figcaption>Figure 8: Delete Action Rule or Decision Table</figcaption></figure><ul><li>To add Decision Table, you need to click the ‘Add decision table’ button on left pane, shown in Figure 8. This shows you the default decision table that contains a condition column (C0), an action column (A0) and 20 rows, see Figure 9.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O1sasb7NmcOoNpzkdRgozw.jpeg" /><figcaption>Figure 9: Default Decision Table</figcaption></figure><p>When you’re done adding the Decision Table, you need to write the rules for your decision table. We will use the business rules define in the first section of this article (Using Decision Task). For our example, enter the given rule statement:</p><pre><strong>Rule Condition:</strong> <strong>amountSpent</strong> is at least <em>&lt;min&gt;</em> and less than <em>&lt;max&gt;<br></em><strong>Rule Action:<br></strong>1. set <strong>discount </strong>to &lt;variable value&gt;<br>2. set <strong>loyaltyType </strong>to &lt;variable value&gt;</pre><p>Now let’s start writing the rules in the decision table by following these steps:</p><ul><li>Rename condition column (C0) to ‘Amount Spent in the last 2 years’ and then right-click the column and choose ‘Define Column…’. An editor window will open where you can write your rules.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SphALFtI39hwUGsNkK3Miw.jpeg" /><figcaption>Figure 10: Define Condition Column</figcaption></figure><ul><li>From the editor window, press Ctrl+Spacebar or Ctrl+Shift+Spacebar (Hierarchical View) to show Content Assist menu, see Figure 11. Select the appropriate terms and phrases based on the given rule condition above.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88hdexp6eG3DRY4nR07Now.jpeg" /><figcaption>Figure 11: Writing Rule Condition</figcaption></figure><ul><li>When you’re done writing the rule condition, click the Define button. Wait until the table finishes loading, then check to see <strong>min</strong> and <strong>max</strong> labels below the Amount Spent column header, see Figure 12.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QnIZZq2RV5BERfluo2TfJg.jpeg" /><figcaption>Figure 12: Rule Condition Column</figcaption></figure><ul><li>Double-click the first row below the min and max labels and enter 350,000 for the min value. Let’s observe our first rule condition which is greater than 350,000, to do this you need to right-click the row, select Change operator and then select the greater than sign (&gt;) as shown in Figure 13.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*plAlOy8GfRpHSuPayNRWlw.jpeg" /><figcaption>Figure 13: Change Operator in Decision Table Row</figcaption></figure><blockquote>Notice: The rule condition column label and the first row becomes red, see Figure 13 and when you change the operator, you will find gaps (yellow sign) on the rows. These gaps are not errors but instead they are warnings which will not cause any issue during runtime. For more details on gaps and overlaps, see <strong>Decision Table Errors and Warnings</strong> section after the last step.</blockquote><ul><li>On the second row, enter 200,000 for the min value and 350,000 for the max value. Fill out the succeeding rows up to the sixth row using the min and max values shown in Figure 14.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*bhOQnrL2hUdjVogz53XKwQ.jpeg" /><figcaption>Figure 14: Amount Min and Max Values</figcaption></figure><ul><li>Rename action column (A0) to ‘Discount’ and then right-click the column and choose ‘Define Column…’. An editor window will open where you can write your rule action.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kOaYs0obCwtj_z2hYZbQ5Q.jpeg" /><figcaption>Figure 15: Define Action Column</figcaption></figure><ul><li>From the editor window, press Ctrl+Spacebar or Ctrl+Shift+Spacebar (Hierarchical View) to show Content Assist menu, see Figure 16. Select the appropriate terms and phrases based on the given rule action above.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBiebrrMY9uVj0kLhYhu1w.jpeg" /><figcaption>Figure 16: Writing Rule Action</figcaption></figure><ul><li>When you’re done writing the rule action, click the Define button. From the decision table, enter the values for Discount column. Double-click the first row below the Discount label and enter 0.2, continue to enter values up to the last row using the values shown in Figure 17.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*fTkeZLSJkXTUZqOECDnmUg.jpeg" /><figcaption>Figure 17: Discount Values</figcaption></figure><ul><li>Notice the values in Discount action column, we need to present the values in percentage format to make it more precise and understandable. To format the values, right-click the Discount action column and choose ‘Format column…’. A formatting editor will open where you can define formatting options for the column, see Figure 18.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wPaOMs57HhB15chIGFsTpQ.jpeg" /><figcaption>Figure 18: Action Column Formatting</figcaption></figure><ul><li>In Action Column Formatting, select the percentage format and then click Update. The discount values should now be converted from a number to percentage format, see Figure 19.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z8eGodDXdZAMC4MnmI-Z9g.jpeg" /><figcaption>Figure 19: Formatted Discount Values</figcaption></figure><ul><li>Since we have 2 rule actions, we need to add another rule action column. To insert a column, right-click the Discount action column, choose ‘Insert column’ and then choose ‘Action after’. Check to see the action column (A2) was added after the Discount action column, see Figure 20.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_APmxeIBr0Htewi8xXpKkA.jpeg" /><figcaption>Figure 20: Adding Another Rule Action Column</figcaption></figure><ul><li>After adding another action column, rename the action column (A2) to ‘Loyalty Type’ and then repeat steps #5 to #7 to define the rule action and from the decision table, enter the values for Loyalty Type column as shown in Figure 21.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3KQMxByvcqPgYYCys_NKA.jpeg" /><figcaption>Figure 21: Define Loyalty Type Rule Action Column</figcaption></figure><h4><strong>Decision Table Errors and Warnings</strong></h4><p>As you enter values to the cells of your decision table, the Decision Editor automatically checks for column errors (red sign) and warnings (yellow sign), see Figure 22.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OIHzIGn8riUAnEhx0qNp9g.jpeg" /><figcaption>Figure 22: Decision Table Errors and Warnings</figcaption></figure><p>The Decision Editor checks for overlaps and gaps in decision table conditions you can hover/point your mouse through the red/yellow sign to verify the error you encountered, see sample in Figure 23.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yk_oT_hFyKKYUWenyuwiFg.jpeg" /><figcaption>Figure 23: Sample Errors/Warnings</figcaption></figure><p>The decision editor helps you to verify these warnings so that the values you entered in each condition throughout the different rows does not overlap or not identical and all possible cases are considered to make sure that there are no gaps in your table. Since these are warnings, it will not cause runtime errors but might affect the result of your rule.</p><p>If you are certain that the warning will not affect the result of your rule, you may want to turn off the checking for gaps and/or overlaps by unchecking the setting in Figure 24, so that the warning signs will disappear.</p><blockquote><strong>NOTE:</strong> If in case the amount spent does not fall to any rule condition (e.g. amount is less than 0) in the decision table, you need to <strong>define default using Action Rule</strong> so that you can still set an appropriate and acceptable value to your result. Check on the next section for more information on Action Rule.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*u7p0ZDN5daPsNNOErKv0SQ.jpeg" /><figcaption>Figure 24: Check gap and overlap setting</figcaption></figure><p>Another way of expressing business rules is by using Action Rule. The following steps describe how to add a simple action rule to your Decision Task.</p><h4><strong>Using Action Rule</strong></h4><p>Action Rule is written as a sentence-like in a natural language which uses an if-then statement to associate a condition (if) with an action (then). To add an action rule, follow the steps below:</p><ul><li>Open the decision editor by clicking the Decision tab or the ‘Open Decision’ in Implementation tab, see Figure 6.</li><li>When the decision editor is open, it shows a basic rule template with one condition (<em>if</em>) and one action (<em>then</em>), see Figure 25.</li><li>In case you want to add another action rule, you may click on the ‘Add action rule’ button as shown in Figure 25.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wGwW_UayatJ3ntBjiLLmOQ.jpeg" /><figcaption>Figure 25: Add Action Rule</figcaption></figure><p>Now, let’s define our action rule, for our example, enter the given rule statement:</p><pre>if <strong>amountSpent</strong> is less than 0 then <br>     set <strong>loyaltyType </strong>to &quot;&quot;; set <strong>discount </strong>to 0;</pre><p>If you are not familiar on writing rules in IBM Operational Decision Management, we provided following the steps on how you could write the rule from the basic template.</p><ul><li>Click the &lt;condition&gt; placeholder to open the Content Assist menu in Figure 26, and then select ‘amountSpent’.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MFvCKNaN1nO3Pq1mqW860Q.jpeg" /><figcaption>Figure 26: Content Assist Menu</figcaption></figure><blockquote><strong>NOTE:</strong> <strong>Content Assist Menu</strong> contains predefined terms and phrases that helps you build your rules. The menu lists terms and phrases that are valid in the current context of the rule. These terms and phrases make the action rule more human readable where creating rules does not require an expert programmer instead the business team can even learn to do this.</blockquote><ul><li>To complete your condition, press Ctrl+Spacebar or Ctrl+Shift+Spacebar (Hierarchical View) to show again Content Assist menu than select the ‘is less than’ phrase and type ‘0’ as the value.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5VndY6CTUNqauEnYmBcgyg.jpeg" /><figcaption>Figure 27: Rule Condition Part</figcaption></figure><blockquote><strong>NOTE:</strong> The rule condition part can be made up of one or more condition statements.</blockquote><ul><li>Click the &lt;action&gt; placeholder and select the phrase ‘set &lt;variable&gt;’ in the menu list.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GXTriuDY9QQrTyFOyOMCzw.jpeg" /><figcaption>Figure 28: Replacing &lt;action&gt; placeholder</figcaption></figure><ul><li>To complete your action, press <em>Ctrl+Spacebar</em> or <em>Ctrl+Shift+Spacebar</em> (Hierarchical View) to show again Content Assist menu then select the ‘loyaltyType’ term. Continue pressing <em>Ctrl+Spacebar</em> or <em>Ctrl+Shift+Spacebar</em> in order to show the valid term or phrase you can use to complete your action. Select the term ‘to’ and then type “”(empty string) as the value, see Figure 29.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0jYOfa-OaDvLtNHBXvKbQ.jpeg" /><figcaption>Figure 29: Rule Action Part</figcaption></figure><ul><li>To add the second rule action, after ‘;’ (semi-colon), repeat step #4 in order to complete the business rule statement as shown in Figure 30.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MsgQhLPO39f_4PZSAntp5w.jpeg" /><figcaption>Figure 30: Completed Action Rule</figcaption></figure><h4><strong>Additional Information:</strong></h4><p><strong>Rule Definition</strong> — This is an optional part of the rule which allows you to define a variable and set its value. You use the rule variable/s to make your business rules less ambiguous and easier to understand. The simplest use of rule variable is to declare a constant value, see<em> Figure 31</em>. The variable ‘minimum_discount’ makes the following rule easier to understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*QE0m1NJMJZhxmczroHOwjA.jpeg" /><figcaption>Figure 31: Simplest use of rule definition</figcaption></figure><p><strong><em>‘else’</em> part of a rule</strong> — This is also an optional part of the action rule which allows you to specify the action when the condition is not met, see sample in <em>Figure 32</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*NExSte756e7dffIw2WxCTA.jpeg" /><figcaption>Figure 32: <em>else</em> part of a rule</figcaption></figure><p><strong>Rule Error List</strong> — This section lists the error/s that you may encounter when writing your rules. It helps you to easily check and fix error/s in your rule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*cqFdAOAdXRvlFgKUYMqLbA.jpeg" /><figcaption>Figure 33: Rule Error List</figcaption></figure><h4>Run the Decision Task in Service Flow Example CSHS</h4><p>Now that you have added your action rule and decision table to a Decision task in a service flow, let’s run our sample implementation by opening the Decision Task in Service Flow Example CSHS in TipsForBAW Toolkit and then run the human service.</p><ol><li>In Customer Information List, click the Approval icon button to open the Approval Request dialog window.</li><li>Expand Customer Loyalty and Rewards Program section.</li><li>Enter the Amount Spent in the last 2 years and click Validate button.</li><li>It should display the corresponding Discount and Loyalty Type based on the rule definitions.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VbjpzeN386LIacC1Ed71Tw.jpeg" /><figcaption>Figure 34: Decision Task in Service Flow Example</figcaption></figure><h3><strong>Implementing Decision Service in a Process</strong></h3><p>After you implement the Decision task in service flow, you can now invoke this service within your process application. This section details 2 ways on how you can implement the Decision service in a process. These are:</p><ol><li>Add Decision Task in a Process</li><li>Attach Decision Service to an Exclusive Gateway in a Process</li></ol><h4><strong>Add Decision Task in a Process</strong></h4><p>You can add a Decision task in your process flow by associating the Decision service for an activity implementation. You use Decision task when you want a decision or condition to determine which associated activity or action will be implemented or invoke.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XwR2KG5LRjcNsCoSlY_rQQ.jpeg" /><figcaption>Figure 35: Decision Task in Process Example Business Process Definition</figcaption></figure><p>Now, let’s look at our sample business process in Figure 35, this scenario shows a simple approval process that will review the additional rewards offer to the customer depending on their loyalty membership type. The customer loyalty and rewards information will be validated to determine which option is subjected for approval. This example will use ‘Determine Additional Rewards’ decision service, see sample rules in Figure 36.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u2YY_GELSPnYl1cDtUqe5A.jpeg" /><figcaption>Figure 36: Determine Additional Rewards Decision Service</figcaption></figure><p>The sample scenario presented in ‘Decision Task in Process Example’ business process definition is available in the <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk">TipsForBAW Toolkit</a> stored in the GitHub repository.</p><p>To add Decision task and associate Decision service as the implementation for an activity in our process flow, follow these steps:</p><ul><li>In the ‘Decision Task in Process Example’ process diagram, click the down arrow of the Activity icon on the component palette and then drag the Decision Task icon as shown in Figure 37.</li><li>Select Decision Task &gt; Implementation tab, select ‘Determine Benefit Level’ as service implementation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jFnvyR2Usi4T40rvrP3DUQ.jpeg" /><figcaption>Figure 37: Adding Decision Task and Decision Service Implementation</figcaption></figure><ul><li>In Data Mapping tab, map the loyaltyType as input and benefitLevel as output.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LOx64-EwWHxqzFFqzyI9xA.jpeg" /><figcaption>Figure 38: Decision Task Data Mapping</figcaption></figure><ul><li>Once the setup is done, you can now run the process to validate the rules by launching the Decision Task in Process Example process, see Figure 39.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V0h1MK8hWXrRPRqrTYDKQA.jpeg" /><figcaption>Figure 39: Running the Decision Task in Process Example Process</figcaption></figure><h4><strong>Attach Decision Service to an Exclusive Gateway in a Process</strong></h4><p>Another way to implement to your decision service in a process is by attaching Decision Service to an exclusive gateway. You use it in your process flow when you have several paths but only one path can be followed depending on the result of the conditions and actions in the rule component of your decision service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NbIFwzUGgx_NT6xx6NHfrw.jpeg" /><figcaption>Figure 40: Decision Service in Exclusive Gateway Example Business Process Definition</figcaption></figure><p>Let’s look at the business process shown in Figure 40, this scenario shows another approval process that uses decision gateway to determine the team assigned to review and approve the customer’s loyalty and rewards information depending on their loyalty membership type. This example will use ‘Determine Assign Approver’ decision service, see sample rules in Figure 41.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9PirDSeT7c7MBa4tWF9JlA.jpeg" /><figcaption>Figure 41: Determine Assign Approver Decision Service</figcaption></figure><p>The sample scenario presented in ‘Decision Service in Exclusive Gateway Example’ business process definition is available in the <a href="https://github.com/IBM-BAW-Assets/tips-for-baw-tk">TipsForBAW Toolkit</a> stored in the GitHub repository.</p><p>To attach a Decision service to an exclusive gateway in our process, follow these steps:</p><ul><li>In the ‘Decision Service in Exclusive Gateway Example’ process diagram, click the down arrow of the Gateway icon on the component palette and then drag the Exclusive Gateway icon as shown in Figure 42.</li><li>Select Exclusive Gateway &gt; Decision tab and then select ‘Determine Benefit Level’ as service implementation and enter loyaltyType as input mapping.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fx7R0G8YI-0vsckE9bcG6w.jpeg" /><figcaption>Figure 42: Attaching Decision Service in Exclusive Gateway</figcaption></figure><ul><li>In Implementation tab, define the decision paths as shown in <em>Figure 43</em>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tG4M7sf_wnJBVz6yJuox4A.jpeg" /><figcaption>Figure 43: Exclusive Gateway Decisions Implementation</figcaption></figure><ul><li>Once the setup is done, you can now run the process to validate the rules by launching the ‘Decision Service in Exclusive Gateway Example’ process, see Figure 44.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wSSfjn8xGHNvLdhlyHtY-g.jpeg" /><figcaption>Figure 44: Running the Decision Service in Exclusive Gateway Example Process</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f2d8e9dbd38" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-implementing-decision-tasks-5f2d8e9dbd38">IBM Business Automation Workflow Implementing Decision Tasks</a> was originally published in <a href="https://medium.com/ibm-business-automation-ap-el">IBM Digital Business Automation Tips and Assets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IBM Business Automation Workflow Server-Side Paging Section Asset]]></title>
            <link>https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-server-side-paging-section-asset-aac32ff324f3?source=rss-baf09048c9c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/aac32ff324f3</guid>
            <category><![CDATA[ibm]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[baw]]></category>
            <category><![CDATA[assets]]></category>
            <category><![CDATA[workflow]]></category>
            <dc:creator><![CDATA[Diorella Mari Tom]]></dc:creator>
            <pubDate>Wed, 11 Mar 2020 02:28:34 GMT</pubDate>
            <atom:updated>2020-08-05T05:39:48.346Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*tpEO4SdcPgDQSVSZei746A.jpeg" /><figcaption>Alexey Poprotsky © 123RF.com</figcaption></figure><p><a href="https://medium.com/@leonard.blunt">Leonard Blunt</a>, <a href="https://medium.com/@gregorius.adrian1994">Greg Ekaprana</a>, <a href="https://medium.com/@okkasudaryanto">Okka Sudaryanto</a>, <a href="https://medium.com/@diorellatom">Diorella Mari Tom</a></p><h3>Code Repository</h3><p><a href="https://github.com/IBM-BAW-Assets/paging-section-tk">Paging Section Toolkit GitHub Repository</a></p><h3>Introduction</h3><p>IBM Business Automation Workflow (BAW) provides a set of APIs that is used to retrieved data from a data source. The JavaScript API provides certain components to improve the behavior of your business process models. There are many ways to retrieve and display your data into data tables, and some of the components you can use are Service Call, Service Data Table and Table views.</p><p>You might find situations dealing with large data sets consisting of thousands, if not hundreds of thousands of records. In such scenarios, retrieving all the data at once to the client is not reasonable, impacts to resource consumption and system performance and efficiently make this impractical. To aid with paging through the records, a pattern supported by a standardized coach view asset was established. With the combination of Server-Side Paging Section Coach View (CV) and server-side queries, we can limit the results and page at the server side, reducing and limiting the number of records retrieved from the source.</p><p>The asset that we will discuss here limits the data retrieved to a table, manages the data paging on the server side and can help satisfy the performance and loading time for a better user experience. In our primary use case in the project for which it has evolved was on dashboards, and as such we found it useful to incorporate an Automatic Refresh feature where based on a fixed time interval the page is reloaded. This is useful on situations where the records are constantly updating in the table and you want to display the records in real-time, or in the business case that we had where the dashboard was a work initiation or trigger point using the records in the table to trigger next actions. Once we had multiple paging, we needed to incorporate to the asset a way to track selected records across pages. This is useful on situations like exporting selected records, mass updating of selected records, mass printing of selected records, etc.</p><p>In this article, we will show you how to use the Server-Side Paging Section Coach View. The example implementation provides the details of the following:</p><ol><li><a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-server-side-paging-section-asset-aac32ff324f3#1365">Setup and Configuration</a></li><li><a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-server-side-paging-section-asset-aac32ff324f3#978a">Custom JavaScript Functions</a></li><li><a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-server-side-paging-section-asset-aac32ff324f3#7527">Implementing the Server-Side Paging Section Coach View</a></li></ol><h3><strong>Setup and Configuration</strong></h3><p>In this section, let’s look through and identify the key components of the view to understand the setup and configuration needs. Figure 1 illustrates the key components of the coach view, we shall provide the explanation and detail on the numbered items.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ep-ys8gikIPt_lzHF7KzTg.jpeg" /><figcaption><em>Figure 1: Paging Section Coach View</em></figcaption></figure><h4>Key Components:</h4><ol><li>Content Box — Table View</li></ol><p>This is where you place the standard Table coach view and customize the columns specific to the data you wish to show. You still need to setup the configuration properties of the table view, how you want your records to be rendered, the look and feel and the behavior of the table. A simple example is shown here,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*shsi1ucJ1D9B4KdRXMTNBg.jpeg" /><figcaption>Figure 2: Table View Example</figcaption></figure><p>In the Behavior Configuration, if you select the Multiple Selection mode, this will trigger the selected record functionality of the paging section. You may check Configuration Properties and JavaScript Functions for more details on how to use Selected Records Tracking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*WGIsnil7NWnMim1M2Sd6kQ.jpeg" /><figcaption>Figure 3: Table View — Behavior Configuration</figcaption></figure><pre><strong>Important:</strong> From the Table view configuration, do not set up the ‘Initial page size’ because this would affect the page size setting from the Server-Side Paging Section CV. Please keep the Behavior configuration setting empty, except for the ‘Selection mode’ configuration option.</pre><p>2. Page Size</p><p>This contains the maximum number of records per page, which limits the records retrieve in the database. The default value is set in the Configuration properties of the Paging Section CV.</p><p>3. Page Counter and Navigation Buttons</p><p>This contains the number of the page the current records display in the table and the navigation buttons that allows you to move through the records in the table. Each button corresponds to the direction that you can move in the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/401/1*G8CiLKh_-ELC0QvSph_nGA.jpeg" /><figcaption>Table 1: Navigation Buttons</figcaption></figure><p>4. Auto Refresh Settings</p><p>These settings are configurable where they set automatic refresh rate of the table.</p><ol><li>On/Off Switch — allows a user to manually turn off refresh on a table that has been configured to auto refresh.</li><li>Interval setting — the time in minutes between the automatic refresh.</li><li>Refresh button — allows a user to manually refresh the table and not wait for the interval.</li></ol><p>The starting properties of auto refresh are configurable in the coach view (Configuration Properties &gt; Auto Refresh).</p><p>5. Selected Records</p><p>This contains an action button to clear the selected records in which if set to true (Configuration Properties &gt; Configuration &gt; Hide Clear Selected), will show the ‘Clear’ selected button, otherwise hide the button. This component will also depend on the chosen selection mode in the Table view configuration, if set to ‘Multiple’, then you should set and bind the value of the property in Configuration Properties &gt; Selected Records Tracking section.</p><pre><strong>Note:</strong> In the coach view, we used style sheet to disable the select all on table. This is a deliberate architecture choice, remember that we are dealing with large data sets. This then created the need for a component to trigger the clear of selected records.</pre><h4>Data Binding — ANY (List)</h4><p>Paging Section CV is bound to any list of objects, this should be the same as the list of objects bounded in the Table view inside the Paging Section CV, see example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hjdSfD5FERnLySOL_ahGPQ.jpeg" /><figcaption>Figure 4: Paging Section CV Binding and Table View Binding</figcaption></figure><h4>Configuration Properties</h4><p>Paging Section CV is also bound to configuration options which are used in managing and handling the data paging, filtering and sorting, automatic refresh and selected records tracking and console logging. The paging section has 4 specific configuration groups (Data Service Configuration, Configuration, Auto Refresh, and Selected Records Tracking) each will now be explained.</p><ol><li>Data Service Configuration</li></ol><p>This configuration group details the downstream service flow and the parameters for this flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*XL4-o4O-ATqf2JqQKwRSWA.jpeg" /><figcaption>Figure 5: Data Service Configuration Options</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mRseH_jRYlUMDMd17CxpMQ.jpeg" /><figcaption>Table 2: Data Service Configuration Descriptions</figcaption></figure><p>The ‘Data Service’ specified in the configuration includes the implementation on retrieving the data from the database where you create and execute SQL statements and return the result as a list of data object. This service flow must have the following parameters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OBKFX9Z55ekfLDeY1ndsiw.jpeg" /><figcaption>Figure 6: Service Flow Parameters and Descriptions</figcaption></figure><pre><strong>Note:</strong><br>1. Filter Data and Sort Data are used and discussed in detailed on the article, &#39;<a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-filtering-and-sorting-coach-view-for-server-side-paging-section-8b163f78976b">IBM BAW Filtering and Sorting Coach for Server-Side Paging Section Asset</a>&#39;.</pre><pre>2. The pageSize value has a very important role on data paging because it limits the records retrieved from the database. It is advised to set the pageSize value to a more acceptable value where users can view the records without further scrolling down, because setting the page size to thousands of records would defeat the purpose of server-side paging solution and might also cause issues on performance and loading time.</pre><p>2. Configuration</p><p>This group is more general operations and appearance settings for the coach view. Very important here is the control id of the embedded table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*YAbBCAK4Bq9BIcS6RCraQQ.jpeg" /><figcaption>Figure 7: Configuration Options</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctQn1tQt_1eAAEQGAFjqZw.jpeg" /><figcaption>Table 3: Configuration Descriptions</figcaption></figure><p>3. Auto Refresh</p><p>This grouping captures the configuration options related to auto refresh of the table data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*T1j1w3kEMroTQ1tutJq46Q.jpeg" /><figcaption>Figure 8: Auto Refresh Options</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XsWrMUx9_3B6bZSfY6G7jA.jpeg" /><figcaption>Table 4: Auto Refresh Descriptions</figcaption></figure><p>4. Selected Records Tracking</p><p>This grouping is specific to a business object that is used to track the selected records over multiple pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*w5Sb3MhzXrh3H-SGMCuk7Q.jpeg" /><figcaption>Figure 9: Selected Records Tracking Options</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2VYWdcsfJ5zY85YAywghIg.jpeg" /><figcaption>Table 5: Selected Records Tracking Descriptions</figcaption></figure><pre><strong>Note:</strong> On the next version of Paging Section asset, Selected Records Tracking configuration will be removed as a configuration options instead it will be placed and handled in inline JavaScript.</pre><h4>Events</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*nLeWcyLNq9wUjK7ZGtqFJQ.jpeg" /><figcaption>Figure 10: Paging Section Coach View Events</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MXXdPo3lAwMfrS7HpUyyPQ.jpeg" /><figcaption>Table 6: Paging Section Coach View Events Descriptions</figcaption></figure><h3><strong>Custom JavaScript Functions</strong></h3><p>This section provides the detailed documentation of the custom JavaScript functions to manipulate data in coach view. These functions are defined in the Inline JavaScript of Paging Section CV.</p><h4>init — Returns: {Object[]}</h4><p>The init() function initializes the table and loads the first page as the current state.</p><h4>reload</h4><p>The reload() function reloads the table and retains all state.</p><h4>refresh</h4><p>The refresh() function refreshes the table, loads the first page as the current state and clears all the records selected from the table.</p><h4>getAllSelectedRecords — Returns: {Object[]}</h4><p>The getAllSelectedRecords() function returns all the selected records in the table (if any).</p><p>Example:</p><pre>var data = _this.ui.get(&quot;Paging_Section_CV1&quot;).getAllSelectedRecords();</pre><h4>hasRowSelected — Returns: {boolean}</h4><p>The hasRowSelected() function returns whether a particular record is selected.</p><p>Example:</p><pre>if (_this.ui.get(&quot;Paging_Section_CV1&quot;).hasRowSelected()) {</pre><pre>     _this.ui.get(&quot;Button1&quot;).setEnabled(true);</pre><pre>} else {</pre><pre>     _this.ui.get(&quot;Button1&quot;).setEnabled(false);</pre><pre>}</pre><h4>clearSelectedRecords</h4><p>The clearSelectedRecords() function clears all the selected records from the table.</p><p>Example:</p><pre>_this.ui.get(&quot;Paging_Section_CV1&quot;).clearSelectedRecords();</pre><h3><strong>Implementing the Server-Side Paging Section Coach View</strong></h3><p>This section details an example and shows how to use the Server-Side Paging Section CV. The example requires to retrieve and display the product purchase data records in the table and to preview the selected product purchase data records. The example will walk you through setting up and retrieving data by creating the end user view as seen here in Figure 11.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57RxvVmnMA8lbRYB8cU5Yg.jpeg" /><figcaption>Figure 11: Server-Side Paging Section User View</figcaption></figure><p>There are four steps to this example:</p><ol><li>Create the client-side human service</li><li>Create the coach view and embed and configure the Paging Section Coach View and Table</li><li>Write the server-side query to retrieve the data</li><li>Extend the example to demonstrate the selected records processing</li></ol><p>The code is available in the <a href="https://github.com/IBM-BAW-Assets/paging-section-tk">Paging Section Toolkit</a> stored in the Git repository.</p><h4>Step 1: Create the client-side human service</h4><p>In the Diagram view, add a coach that provide the user interface to display the product purchase data records in the table, see Figure 12.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*eRHLm4jFofgeKoffwoP_7Q.jpeg" /><figcaption>Figure 12: <em>Paging Section CSHS implementation example</em></figcaption></figure><p>In the view for the coach, add the PurchaseProductTableCV and bound it to the data list, see Figure 13.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wcXSdn_BdA9_Oq88VzOcbg.jpeg" /><figcaption>Figure 13: <em>Paging Section CSHS coach layout example</em></figcaption></figure><p>In the coach view configuration options, pass the PagingSectionInit business object and the selected data list, see Figure 14.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*9RBKZlWW816pW_ZLeuCp3A.jpeg" /><figcaption><em>Figure 14: PurchaseProductTableCV Configuration Options</em></figcaption></figure><h4>Step 2: Create the coach view and embed and configure the Paging Section Coach View and Table</h4><p>PurchaseProductTableCV coach view is bound to the data list and has the PagingSectionInit business object passed as a configuration variable. It also has two other configuration variables which are: inputData string that is passed when you have an additional data on retrieving records and selectedPurchaseDataList that is used when working on selected records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*LzZG_k5PrMZ4m2G4q7ZZNw.jpeg" /><figcaption><em>Figure 15: PurchaseProductTableCV variable declarations</em></figcaption></figure><p>In the coach view, we embed the following view components:</p><ol><li>Paging Section coach view</li><li>Table coach view which is placed in the context box of the Paging Section Coach View</li><li>Other components include a button and modal section that will be used to demonstrate working with selected records.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TwYetRbahUhapLo7q91jPA.jpeg" /><figcaption><em>Figure 16: PurchaseProductTableCV coach view layout and binding</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FCSslpuhynBvWrhuiYwSZA.jpeg" /><figcaption><em>Figure 17: PurchaseProductTableCV Configuration Options</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pp5-MQ72-utGoTZFjW4SCg.jpeg" /><figcaption><em>Figure 18: Table View Binding and Configuration Options</em></figcaption></figure><pre><strong>Note:</strong> Another component that you can add in this coach view is the server-side table filter and sort implementation which will be discussed in detailed on the article, &#39;<a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-filtering-and-sorting-coach-view-for-server-side-paging-section-8b163f78976b">IBM BAW Filtering and Sorting Coach for Server-Side Paging Section Asset</a>&#39;, as this asset only focuses on data paging.</pre><h4>Step 3: Write the Server-Side Query</h4><p>When the human service is launch, purchase data records are retrieved and displayed in the table. The table is populated by executing a service flow that query the records in the database, see implementation in Figure 19.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Wi5vmOVfNDVCjcVLJlifw.jpeg" /><figcaption><em>Figure 19: Get Product Purchase service flow example</em></figcaption></figure><p>This service flow includes the following:</p><ol><li>Server scripts to construct SQL statements that will retrieve the records and total number of records in the database.</li></ol><ul><li>SQL statement to retrieve records</li></ul><pre>SELECT<br>EPP.ID AS ID,<br>RECEIPT_ID AS RECEIPTID,<br>PURCHASE_DT AS PURCHASEDT,<br>PURCHASE_AMT AS PURCHASEAMT,<br>COUNTRY AS COUNTRY,<br>CITY_CD AS CITYCD,<br>ECC.CITY_NM AS CITYNM,<br>PRODUCT_TP AS PRODUCTTP,<br>EPT.PRODUCT_NM AS PRODUCTNM<br>FROM &lt;#= tw.env.DSN_NEWSCHEMA_NAME #&gt;.EG_PRODUCT_PURCHASE EPP<br>LEFT JOIN &lt;#= tw.env.DSN_NEWSCHEMA_NAME #&gt;.EG_CITY_CODE ECC ON ECC.CD = EPP.CITY_CD<br>LEFT JOIN &lt;#= tw.env.DSN_NEWSCHEMA_NAME #&gt;.EG_PRODUCT_TYPE EPT ON EPP.PRODUCT_TP = EPT.ID</pre><ul><li>SQL statement to get total number of records</li></ul><pre>SELECT &#39;TOTAL&#39; as NAME, CHAR(COUNT(*)) as VALUE FROM &lt;#= tw.env.DSN_NEWSCHEMA_NAME #&gt;.EG_PRODUCT_PURCHASE</pre><p>2. Server script to add LIMIT and OFFSET clauses to the query. These two query clauses are very important in dealing with large result sets. LIMIT is used to limit the number of rows returned by the query and OFFSET instructs the database where to start returning rows within the query result. It is required to add LIMIT and OFFSET to your SQL query for the server-side paging section.</p><pre>tw.local.sql = tw.local.sql + &quot; LIMIT &quot; + tw.local.pageSize + &quot; OFFSET &quot; + ((tw.local.currPage -1) * tw.local.pageSize);</pre><p>3. Service tasks that will invoke SQL Integration service to execute the SQL and retrieve records from the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*bTz8tHSbxpiDiq348a3FdQ.jpeg" /><figcaption>Figure 20: <em>SQL Integration Service Implementation</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-Wk4SDDu8RtJX4-7qAgsw.jpeg" /><figcaption>Figure 21: Service Task &gt; <em>Input and Output Mappings</em></figcaption></figure><pre><strong>Note:</strong> Filter and Sort script contains the details on handling filtering and sorting of the table which will be discussed in detailed on the article, &#39;<a href="https://medium.com/ibm-business-automation-workflow-tips-tricks-and/ibm-business-automation-workflow-filtering-and-sorting-coach-view-for-server-side-paging-section-8b163f78976b">IBM BAW Filtering and Sorting Coach for Server-Side Paging Section Asset</a>&#39;.</pre><p>To test, run the Paging Section CSHS from the Web Designer and this should display the screen in Figure 22.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57RxvVmnMA8lbRYB8cU5Yg.jpeg" /><figcaption><em>Figure 22: Product Purchase Data List Table example</em></figcaption></figure><h4>Step 4: Extend the example to demonstrate the selected records processing</h4><p>Once you have the multiple paging view, you can also extend your implementation to incorporate the selected records tracking. This example includes a ‘Request Review’ button and modal section that will demonstrate the selected records processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BO5FAM_3BgwOr1l3O0_c4w.jpeg" /><figcaption><em>Figure 23: PurchaseProductTableCV coach view layout with ‘Request Review’ button and modal section</em></figcaption></figure><p>Selecting of record/s in the table will enable the ‘Request Review’ button. To enable/disable the button, you need to call the <a href="https://github.com/IBM-BAW-Assets/paging-section-tk/blob/master/snippets/enableRequestReviewButton.js"><em>enableRequestReviewButton()</em></a> function on ‘On row selected by user’ event of the Table view. This will check if the user selected any record/s on the table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*fNZS4PKqiJzUaChv6U4SKw.jpeg" /><figcaption>Figure 24: <em>PurchaseProductTableCV Table View Events — On row selected by user</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*BwxXc8scLyqSd4s1GK_0DA.jpeg" /><figcaption>Figure 25: <em>PurchaseProductTableCV — enableRequestReviewButton()</em></figcaption></figure><p>When you click this button, it will launch the ‘Request Review’ modal section to preview the selected product purchase data. The ‘On click’ event of the ‘Request Review’ button calls the <a href="https://github.com/IBM-BAW-Assets/paging-section-tk/blob/master/snippets/requestReview.js"><em>requestReview()</em></a> function which will get all selected records and display the selected purchase data on the list table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*B1c5DFPDmjkbuMxCS3FOog.jpeg" /><figcaption>Figure 26: <em>PurchaseProductTableCV Request Review Button Events — On click</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*5G2gmypWNM5Kk4jDzG6_vg.jpeg" /><figcaption>Figure 25: <em>PurchaseProductTableCV — requestReview()</em></figcaption></figure><p>To test, run again the Paging Section CSHS from the Web Designer and this will display the screens in Figure 26 and Figure 27.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vAsb5YXoazduOAt4LoqCKQ.jpeg" /><figcaption><em>Figure 26: Select Product Purchase Data</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lscGlxlERJ9OdsqM_O9J-A.jpeg" /><figcaption><em>Figure 27: Preview of the Selected Product Purchase Data List example</em></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aac32ff324f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ibm-business-automation-ap-el/ibm-business-automation-workflow-server-side-paging-section-asset-aac32ff324f3">IBM Business Automation Workflow Server-Side Paging Section Asset</a> was originally published in <a href="https://medium.com/ibm-business-automation-ap-el">IBM Digital Business Automation Tips and Assets</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>