Manage Algorithms

Service mappings are used with algorithms to customize data sent to the destination tables.

Entities are used to create custom fields or identify standard fields that receive their input values from view object attributes. Services refer to the algorithms that can be used to modify or transform a field in the entity based on Groovy scripts and define the entity attributes that can be read and written by the algorithm.

If you need to make any customizations in your algorithm, then the customization option must be enabled by changing the Customization option of the QP_ALGO_ENABLE_FACTORY_MODE_RUN profile option to True. Go to Setup and Maintenance > Manage Administrator Profile Values to update this value.

If you customize the algorithm but don't change the Customization option to True, then your customizations won't be picked.

To promote existing algorithms or create a new version, click the Action menu from the Manage Algorithms page. The new version of the algorithm's status will be In Progress.

The algorithm has two predefined data sets:

  • AssetMap
  • Fline

On the Edit Algorithm you can create new rows, such as SoHeader and LineEFF, to manage your custom attributes. Use values such as these:

Column Name Column Value Notes
Name SoHeader Custom Name
Variable Path Enter AssetRequest.SalesOrderHeader
  • AssetResquest: Target entity.
  • SalesOrderHeader: This comes from the Service Mapping set up document.
Cardinality Zero or One Pick this value.
Data Set Join [HeaderId: {SoHeader.HeaderId}]
  • HeaderId: Sales Order Header ID
  • SoHeader: Target Entity Value
  • HeaderId: Sales Order Header ID

For Header lines, use information such as this.

Column Name Column Value Notes
Name HeaderEFF Entity Name
Variable Path AssetRequest.HeaderEFF_Custom
  • AssetResquest: Value of your target Entity.
  • HeaderEFF_Custom: This Service Mapping set up Document.
Cardinality Zero or One Pick This Value.
Data Set Join [HeaderId_Custom: {SoHeader.HeaderId}]
  • HeaderID_Custom: Custom Attribute name represents the Sales Order Header ID
  • SoHeader: Value for the target entity.
  • HeaderId: Header ID Unit identifier.

For lines, use information such as this.

Column Name Column Value Notes
Name LineEFF Entity Name
Variable Path AssetRequest.LineEFF_Custom
  • AssetResquest: Your target Entity.
  • LineEFF_Custom: Value of the table of the service mapping set up Document.
Cardinality Zero or One Pick this value.
Data Set Join [FulfillLineId_Custom : {Fline.FulfillLineId}]
  • FulfillLineId: This is the custom Attribute name represents the Sales Order Header ID.
  • Fline: Value for the target entity.
  • FulfillLineId_Custom: This comes from the entity value of the table of the Service Mapping set up document.

Execute Conditions for Algorithms

You define the set up the rules for your entities and attributes. These are groovy scripts statements. Groovy is a standard, dynamic scripting language for the Java platform for which your Oracle cloud provides deep support. You may want leverage groovy documentation to understand the basics of how you can use the Groovy scripting language to enhance your applications.

When a context requires using a Groovy script, you will typically use a short one-line script, called an expression, however technically the terms script and expression are interchangeable. Anywhere you can provide a one-line expression is also a valid context for providing a multi-line script if the need arises. Whether you provide a short expression or a multi-line script, the syntax and features at your disposal are the same. You only need to verify that your code returns a value of the appropriate type for the context in which you use it.

Here are some sample of groovy scripts:

  • AssetMap.CutomerAssetStartDate = FLine.FulfillLineFulfillmentDate ? : Fline.FulfillLineActualShipDate ?: Now ())

    • When a service order is created both the Customer and Asset Start Date are equal to Sales Order Fulfillment Date and Asset Actual Ship Date is equal to System Date.

  • AssetMap.CustomerAssetStartdate = now () – 30

    • When a service order is created the Customer Asset Start Date would be System date minus 30 Days.

  • AssetMap.AssetAppCompChar4_Custom = HeaderEFF?.HeaderEFFAttri1_Custom

    • When SO is created the Value entered under you SO header Custom Attribute (Custom Attribute 1) is mapped Asset App Composer Custom attribute (Char 4)

Testing Algorithms

The goal of the testing is to simulate data entry at the source attribute and to retrieve the results on the same .XML file. You can test your algorithm by selecting the Test tab and then click the Add New button to create a new xml script name.

Then, click on the pencil icon to edit your .XML file. This will enable a popup dialog for you to interact with your variable values.

Next, run your testing script by entering your test inputs values on the .XML file type. Follow this sample below.

Source data Example Notes
<CustomerAssetStartDate> 2022-06-27T22:00:00.000 This is your asset start date. A system date is OK here. Make sure you are following this format.
<AssetOrderService:FulfillLineId> 111 This is your sales order line ID, a number value should OK.
<AssetOrderService:HeaderId> 222 This is your sales order header ID, a number value should be OK.
<AssetOrderService:MapId> 333 This is your map ID, a number value should be OK.
<AssetOrderService:HeaderEFFAttri1_Custom> ATTR1 This is your source Sales Order Header Custom attribute. Make sure to select the correct attribute type (Character, Number, Date, and so on.)
<AssetOrderService:HeaderEFFNum1_Custom> 10101 This is the source Sales Order Header Custom attribute. Make sure to select the correct attribute type (Character, Number, Date, and so on.)
<AssetOrderService:HeaderEFFDate1_Custom> 2022-06-27T22:00:00Z This is the source Sales Order Header Custom attribute. Make sure to select the correct attribute type (Character, Number, Date, and so on. )
<AssetOrderService:FulfillLineEFFAttri1_Custom> ATTRFL1 This is the source Sales Order Line Custom attribute. Make sure to select the correct attribute type (Character, Number, Date, and so on.)
<AssetOrderService:FulfillLineEFFNum1_Custom> 101001 This is the source Sales Order Line Custom attribute. Make sure to select the correct attribute type (Character, Number, Date, and so on.)
<AssetOrderService:FulfillLineEFFDate1_Custom> 2022-06-27T22:00:00Z This is the source Sales Order Line Custom Attribute. Make sure to select the correct attribute type (Character, Number, Date, and so on.)

You should see the results you expect. For example, if you enter a value of HeaderEFFAttri1_Custom>ATTR1< Then, the same value would be displayed as outcome on the AssetAppCompChar4_Custom>ATTR1< result region when the test is executed.

In order to have the result rows corrected, you may need to run your script by selecting the RUN TEST button.

Your test is ended when the Last Execution Status displays a check mark.