Oracle by Example brandingCreating Logic Extensions

section 0Before You Begin

This 45-minute tutorial shows you how to create a logic extension and explains how to add:

  • An Assignment.
  • A While loop.
  • An If Else condition.

Background

The Orchestrator Studio provides a web-based user interface to create logic extensions. Using logic extensions, you can create business logic to perform operations such as string manipulation, arithmetic calculations, conditions, loops, and even table I/O. Using the logic extensibility framework, you can use the familiar syntax of the JD Edwards Named Event Rules language to create custom logic. The logic extensions component can be added as a step in an orchestration.

Scenario

This tutorial considers a scenario in which a company needs to provide a cost-of-living adjustment (COLA) to its employees. The logic extension created in this tutorial helps the VP of the HR department to understand the increase in total company salary depending on the percentage increase in employee salary. The VP can enter different input in the Percentage Increase field of the logic extension to understand the impact of employee salary increase on the total company salary .


section 1Adding the Data Dictionary Items and Variables

In this section, you will learn how to add the data dictionary items to the data structure of your logic extensions and how to add variables. These data dictionary items and variables are used in the Logic section of your logic extension, in places such as Table Input and Output (I/O), Assignments, Errors, If/Else, and While statements.

Adding the Data Dictionary Items

  1. Sign in to the Orchestrator Studio.
  2. Click Logic Extensions and click New.
  3. In the Name field, enter Review giving a COLA.
  4. To define the Data Structure, click the Data Structure icon.
  5. Logic Extensions - Data Structure icon
    Logic Extensions - Data Structure icon
  6. Click the Add icon (+).
  7. In the Add Data Dictionary window, in the Alias field, enter HMCO.
  8. Add Data Dictionary Window
    Add Data Dictionary Window
  9. Click the Add icon (+). You can see CompanyHome listed in the first row.
  10. Enable the Required option for HMCO.
  11. To add another Data Dictionary item, click the Add icon again.
  12. In the Add Data Dictionary window, in the Alias field, enter SAL, and then click the Add icon.
  13. You can see a new row for SAL. Rename the Name field to Percent Increase.
  14. Enable the Required option for the Percent Increase row.
  15. Duplicate the SAL entry four times:
    1. Click the drop-down menu next to SAL in the Dictionary field, and select Duplicate as Data Structure.
    2. Duplicate as Data Structure Option
      Duplicate as Data Structure Option
    3. Repeat the above step three more times to add five entries in total with SAL as the data dictionary item.
    4. Make these changes:
    5. Verify that your data dictionary items are displayed as shown in the following screenshot.
    6. Data Dictionary Window
      Data Dictionary Window
    7. Click Save.

Adding the Variables

  1. Click the Variables icon.
  2. Logic Extensions - Variables icon
    Logic Extensions - Variables icon
  3. Click the Add icon (+).
  4. In the Add Data Dictionary window, in the Alias field, enter PAST, and click the Add icon.
  5. Rename the value in the Name field to vEmployeePayStatus.
  6. Click the Add icon.
  7. In the Alias field, enter SAL, and click the Add icon.
  8. Rename the value in the Name field to vAccumulate Salary.
  9. Click the drop-down menu next to SAL, and select Duplicate as Variable.
  10. Duplicate as Variable Option
    Duplicate as Variable Option
  11. Rename the value in the Name field to vAccumulate Percent Total.
  12. Click the Add icon, in the Alias field, enter HMCO, and then click the Add icon.
  13. Rename the value in the Name field to vCompanyHome.
  14. Verify that your variables are displayed as shown in the following screenshot.
  15. Variables
    Variables
  16. Click Save.

section 2Adding the Table Input and Output

In this section, you will learn how to add table input and output to your logic extension. You will also be introduced to using a While loop to get the information you need from the tables within the system. In this task, you will understand how to read through the F060116 (Employee Master) table.

  1. Click the Logic icon.
  2. Hover over the line between the start and end nodes.
  3. Logic Window
    Logic Window
  4. Click the Add icon (+).
  5. Add Icon
    Add Icon
  6. Select Table IO.
  7. Table IO Option
    Table IO Option
  8. In the Table IO window in the right pane, in the Object Name field, enter F060116.
  9. Press the Tab key.
  10. From the Operation – Fetch Single drop-down menu, select Select All. You can now see the Iterate Records icon.
  11.  Operation Drop-Down Menu - Select All
    Operation Drop-Down Menu - Select All
  12. Click the Iterate Records icon.
    The system generates a While loop to loop over the F060116 (Employee Master) table. You can see a red exclamation point for each of the elements that needs correction.
  13. While Loop
    While Loop
  14. Modify the first Fetch Next IO block after the Select All block.
    1. Select the first Fetch Next IO block.
    2. In the Index field on the right panel, click the Launch Index Selector icon.
    3. In the Table Index Selector window, click Company Home, Union Code, A+.
    4. Click the Launch Column Mapping Builder icon.
    5. In the Column Mapping - Fetch Next window, enable the Return option for the CompanyHome [HMCO] column, and from the Quick Selection drop-down menu (in the right pane), select vCompanyHome.
    6. Column Mapping - Fetch Next Window
      Column Mapping - Fetch Next Window
    7. Similarly, map EmployeePayStatus to variable vEmployeePayStatus and map RtSalary to the variable vAccumulate Salary.
  15. Click Close. Verify that the mappings are displayed as shown in the following screenshot:
  16. Table IO Mappings
    Table IO Mappings
  17. Right-click the Fetch Next block and select Copy.
  18. Copy Option
    Copy Option
  19. Within the While loop, hover over the line between Equals success and Fetch next, and then right-click the Add icon and click Paste.
  20.  Paste Option
    Paste Option
  21. Right-click the Fetch Next block that has the red exclamation point and click Delete.
    Verify that you do not see any red exclamation icons in your logic extension. Your logic extension should look like this:
  22. Logic Extension
    Logic Extension
  23. Click Save.

section 3Adding the First Assignment Block

In this section, you will learn how to add an assignment block. You can define logic to perform most of the tasks in the assignment block. In the assignment block, you can define actions to perform operations such as calculations, assignments, work with dates, text manipulations, and so on.

In this task, you will add an assignment and you will learn how to initialize the variables and some data structure values to zero. You will also learn how to convert an entered amount into a percent value.

  1. Drag and drop the assignment block from the left pane to the Add icon (+) between the Select All and Fetch Next elements.
    Note: You can also hover over the line between the Select All and Fetch Next elements and then click the Add icon and select the assignment block.
  2. Assignment Block
    Assignment Block
  3. In the right pane, in the Description field, enter Initialize Output Values.
  4. Click the Launch Assignment Mapping Wizard icon, to create assignments for the variables.
  5. In the Assignment Builder window, you can see that the Pencil icon is highlighted the Target column. In the right pane, select Employee Count from the Quick Selection drop-down menu.
  6. You can now see that the Pencil icon is highlighted in the Source column. In the right pane, click the Literals icon.
  7. In the Single Value field, enter 0.
  8. Click OK to move to the next row of Target and Source fields.
  9. Follow the similarfp process described in the above steps to map the targets Total Company Salary, Proposed Company Increase, Proposed Total Company Sal, vAccumulate Salary, and vAccumulate Percent Total to the literal value 0.
  10. Assignment Builder - Mappings
    Assignment Builder - Mappings
  11. For the Percent Increase target row, click the Source value, and select the Expressions icon in the right panel, and click the Multiply icon (X).
  12. In the Source field for Percent Increase, you can see that the Pencil icon is highlighted. Select Percent Increase from the Quick Selection drop-down menu.
  13. Now the second Pencil icon is highlighted after the Multiply icon (X). Select the Literal icon in the right pane, enter 0.1, and click OK.
  14. Assignment Builder - Mappings
    Assignment Builder - Mappings
  15. Verify that your assignments are displayed as shown in the following screenshot:
  16. Assignment Block Window
    Assignment Block Window
  17. Click Save.

section 4Adding an If Else Statement

In this section, you will learn how to add an If Else statement. Using an If Else statement, you can create branches to different sets of assignments depending on the conditions you have set. In this task, you will understand how to accumulate and calculate the salaries of active employees.

  1. Hover over the line between Equals success and Fetch Next, click the Add icon (+), and click If Else.
  2. If Else Statement
    If Else Statement
  3. In the right pane, in the If Else section, in the Description field, enter If Active Employee.
  4. In the If Branch section, in the Branch Label field, enter Active Employee and in right company.
  5. In the Else Branch section, in the Branch Label field, enter Inactive Employee or wrong company.
  6. In the If Branch section, click the Launch Criteria Builder icon.
  7. In the Criteria Builder window, use the Quick Selection field and Literal icon from the right panel , and build the following conditions:
    CompanyHome is equal to vCompanyHome
    AND vEmployeePayStatus is equal to “0

    After you build the conditions, the Criteria Builder window should look like this:
  8. Criteria Builder Window
    Criteria Builder Window
  9. Verify that your mappings are displayed as shown in the following screenshot:
  10. If Else Window
    If Else Window
  11. Click Save.

section 5 Adding the Second Assignment Block

In this section, you will understand how to add a second assignment block for the logic extension. Using this assignment block, you will learn how to accumulate the number of active employees who are being processed and their salaries, and calculate their new salary using the entered percentage increase.

  1. Hover between the Active Employee's If branch and Fetch Next elements, and click the Add icon (+), and then select Assignment.
  2. Logic Extension
    Logic Extension
  3. In the right pane, in the Description field, enter Track Employee Count.
  4. Click the Launch Assignment Mapping Wizard icon.
  5. In the Assignment Builder window:
    1. You can see that the Pencil icon is highlighted in the first row of the Target field. From the Quick Selection drop-down menu in the right panel, select Employee Count.
    2. Assignment Builder
      Assignment Builder
    3. You can see that the Pencil icon is highlighted in the Source field. In the right pane, click the Expressions icon.
    4. Click the + expression.
    5. Assignment Builder
      Assignment Builder
    6. In the Source field, the first Pencil icon is highlighted. Select Employee Count from the Quick Selection drop-down menu from the right pane.
    7. Assignment Builder
      Assignment Builder
    8. Now the second Pencil icon is highlighted in the Source field. In the right pane, click the Literal icon. Enter the value as 1 and click OK. The cursor moves to the second row automatically.
    9. Assignment Builder
      Assignment Builder
    10. Follow the process described in the above steps to add these mappings.

      Total Company Salary <- vAccumulate Salary + Total Company Salary

      vAccumulate Percent Total
      <- vAccumulate Salary x Percent Increase

      Proposed Company Increase
      <- vAccumulate Percent Total + Proposed Company Increase

      After you add the mappings, the Assignment Builder window should like this:
    11. Assignment Builder
      Assignment Builder Window
    12. Verify that your mappings are displayed as shown in this screenshot:
    13.  Assignment Block - Mappings
      Assignment Block - Mappings
    14. Click Save.

section 6Adding the Third Assignment Block

In this section, you understand how to create a third assignment block for the logic extension. In this assignment block, you will add logic to calculate the proposed total company salary by adding the processed salary increase and the total company salary.

  1. Drag and drop the assignment block from left pane to the Add icon (+) between While and End.
  2.  Assignment Block
    Assignment
  3. In the right pane, in the Description field, enter Total New Salary.
  4. Click the Launch Assignment Mapping Wizard icon, and in the Assignment Builder window, map Target to Source as:

    Proposed Total Company Salary <- Proposed Company Increase + Total Company Salary
  5.  Assignment Builder
    Assignment Builder
  6. Close the Assignment Builder window.
  7. Click Save.
  8. From the Manage menu, select Create Orchestration.
  9. Save the orchestration.

section 7Testing the Logic Extension

In this section, you will learn how to test the logic extension.

  1. In the Review giving a COLA orchestration, click the Start icon and click Run Orchestration. 
  2. Enter the required input for CompanyHome and Percent Increase. For example, enter 00077 and 5, respectively.
  3. Click the Run button.
  4. Verify the results in the Output section.

    Note: You can enter different inputs and verify the new results.
  5. Test Window
    Test Window

more informationWant to Learn More?