Before 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 .
Adding 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
- Sign in to the Orchestrator Studio.
- Click Logic Extensions and click New.
- In the Name field, enter
Review giving a COLA.
- To define the Data Structure, click the Data Structure icon.
- Click the Add icon (+).
- In the Add Data Dictionary window, in the Alias field, enter
HMCO
. - Click the Add icon (+). You can see CompanyHome listed in the first row.
- Enable the Required option for HMCO.
- To add another Data Dictionary item, click the Add icon again.
- In the Add Data Dictionary window, in the Alias field, enter
SAL
, and then click the Add icon. - You can see a new row for SAL. Rename the Name field to
Percent Increase
. - Enable the Required option for the Percent Increase row.
- Duplicate the SAL entry four times:
- Click the drop-down menu next to SAL in the Dictionary field, and select Duplicate as Data Structure.
- Repeat the above step three more times to add five entries in total with SAL as the data dictionary item.
- Make these changes:
- Verify that your data dictionary items are displayed as shown in the following screenshot.
- Click Save.
Adding the Variables
- Click the Variables icon.
- Click the Add icon (+).
- In the Add Data Dictionary window, in the Alias field, enter
PAST
, and click the Add icon. - Rename the value in the Name field to
vEmployeePayStatus
. - Click the Add icon.
- In the Alias field, enter
SAL
, and click the Add icon. - Rename the value in the Name field to
vAccumulate Salary
. - Click the drop-down menu next to SAL, and select Duplicate as Variable.
- Rename the value in the Name field to
vAccumulate Percent Total
. - Click the Add icon, in the Alias field,
enter
HMCO
, and then click the Add icon. - Rename the value in the Name field to
vCompanyHome
. - Verify that your variables are displayed as shown in the following screenshot.
- Click Save.
Adding 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.
- Click the Logic icon.
- Hover over the line between the start and end nodes.
- Click the Add icon (+).
- Select Table IO.
- In the Table IO window in the right pane, in the Object Name
field, enter
F060116
. - Press the Tab key.
- From the Operation – Fetch Single drop-down menu, select Select All. You can now see the Iterate Records icon.
- 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. - Modify the first Fetch Next IO block after the Select All
block.
- Select the first Fetch Next IO block.
- In the Index field on the right panel, click the Launch Index Selector icon.
- In the Table Index Selector window, click Company Home, Union Code, A+.
- Click the Launch Column Mapping Builder icon.
- 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.
- Similarly, map
EmployeePayStatus
to variablevEmployeePayStatus
and mapRtSalary
to the variablevAccumulate Salary
.
- Click Close. Verify that the mappings are displayed as shown in the following screenshot:
- Right-click the Fetch Next block and select Copy.
- Within the While loop, hover over the line between Equals success and Fetch next, and then right-click the Add icon and click Paste.
- 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: - Click Save.
Adding 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.
- 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. - In the right pane, in the Description field, enter
Initialize Output Values
. - Click the Launch Assignment Mapping Wizard icon, to create assignments for the variables.
- 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.
- You can now see that the Pencil icon is highlighted in the Source column. In the right pane, click the Literals icon.
- In the Single Value field, enter
0
. - Click OK to move to the next row of Target and Source fields.
- 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.
- 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).
- 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.
- 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. - Verify that your assignments are displayed as shown in the following screenshot:
- Click Save.
Adding 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.
- Hover over the line between Equals success and Fetch Next, click the Add icon (+), and click If Else.
- In the right pane, in the If Else section, in the
Description field, enter
If Active Employee
. - In the If Branch section, in the Branch Label field, enter
Active Employee and in right company
. - In the Else Branch section, in the Branch Label field, enter
Inactive Employee or wrong company
. - In the If Branch section, click the Launch Criteria Builder icon.
- 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 tovCompanyHome
ANDvEmployeePayStatus
is equal to “0
”
After you build the conditions, the Criteria Builder window should look like this: - Verify that your mappings are displayed as shown in the following screenshot:
- Click Save.
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.
- Hover between the Active Employee's If branch and Fetch Next elements, and click the Add icon (+), and then select Assignment.
- In the right pane, in the Description field, enter
Track Employee Count.
- Click the Launch Assignment Mapping Wizard icon.
- In the Assignment Builder window:
- 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.
- You can see that the Pencil icon is highlighted in the Source field. In the right pane, click the Expressions icon.
- Click the + expression.
- In the Source field, the first Pencil icon is highlighted. Select Employee Count from the Quick Selection drop-down menu from the right pane.
- 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. - Follow the process described in the above steps to add
these mappings
.
Total Company Salary
<-vAccumulate Salary
+Total Company Salary
<-
vAccumulate Percent TotalvAccumulate Salary x
Percent Increase
<-
Proposed Company IncreasevAccumulate Percent Total
+Proposed Company Increase
After you add the mappings, the Assignment Builder window should like this: - Verify that your mappings are displayed as shown in this screenshot:
- Click Save.
Adding 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.
- Drag and drop the assignment block from left pane to the Add icon (+) between While and End.
- In the right pane, in the Description field, enter
Total New Salary
. - 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
- Close the Assignment Builder window.
- Click Save.
- From the Manage menu, select Create Orchestration.
- Save the orchestration.
Testing the Logic Extension
In this section, you will learn how to test the logic extension.
- In the Review giving a COLA orchestration, click the Start icon and click Run Orchestration.
- Enter the required input for CompanyHome and Percent
Increase. For example, enter
00077
and5
, respectively. - Click the Run button.
- Verify the results in the Output section.
Note: You can enter different inputs and verify the new results.