Data Sets in Pricing Algorithm Steps

Use a data set to filter the set of records that the step processes. All steps use a data set, and all data sets have the same attributes. Some steps include more than one data set.

Let's take a look at an example where a user in Order Management manually adjusts price. Order Management sends a request to Oracle Pricing to reprice the item according to the adjustment, and validate it to make sure it falls within your pricing set up. For example, to make sure it doesn't exceed the adjustment that the price list allows.

example where a user in Order Management manually adjusts price.

Note

  • The sales order includes one order line.

  • Pricing represents the sales order in the PriceRequest service data object.

  • The PriceSalesTransaction pricing process sends data in attributes, such as HeaderId.

  • The data is flat. It isn't hierarchical. The header and line are at the same level. This means you can reference a line without worrying about including the hierarchy in your reference.

The PriceRequest service data object adds charges.

The PriceRequest service data object adds charges.

Note

  • The sales order includes only one line, and the line includes only one charge.

  • Each charge in the PriceRequest service data object includes one charge component.

  • Assume some steps of the pricing algorithm have already run and produced values for charges and charge components, such as 300 for ExtendedAmount.

Structure of the Data Sets

Here are some of the data sets from the Validate Manual Adjustment step of the predefined Apply Manual Adjustments For Goods And Services pricing algorithm.

some of the data sets from the Validate Manual Adjustment step of the predefined Apply Manual Adjustments For Goods And Services pricing algorithm.

Note

  1. The primary data set stores data that meets the goal of the step. For example, if the goal of the step is to calculate a charge, then set ChargeComponent as the primary.

    The primary data set is usually the first data set in the Data Sets area.

  2. Use the Variable Path to point to the service data object. For example, PriceRequest.Header references the Header entity in the PriceRequest service data object.

  3. Use Cardinality to specify the number of records in the nonprimary data set you're adding to the primary data set. For example, Zero or one in the Header data set means there is no more than one header for each ChargeComponent.

  4. Use the Data Set Join to join the data set you're adding to another data set in the Data Sets area. Use this format.

    [implicit reference: {target.targetAttribute}]

    where

    • implicit reference is the name of an attribute in the entity of the data set you're currently editing.

    • target is the name of the data set you're joining to.

    • target attribute is the name of an attribute in the entity that the target data set references.

    For example, join the Header data set to the Line data set.

    [HeaderId: {Line.HeaderId}]

    where

    • HeaderId: is the name of an attribute in the Header entity. It identifies the order header. An attribute you include before the colon is an implicit reference to the entity you specify on the Variable Path of the data set you're currently editing.

    • Line is the name of the data set you're joining to.

    • .HeaderId is an attribute of the Line entity. The Line data set references the Line entity. An attribute that you include after the dot ( . ) is an explicit reference to an attribute in the target data set's entity.

      Each order line is part of a sales order. The Line entity includes the HeaderId attribute so the data model knows where the line belongs.

Here's how you map the data set to the service data object.

how you map the data set to the service data object.

Note

  1. Add the primary data set first. For example, PriceRequest.ChargeComponent references the ChargeComponent entity in the PriceRequest service data object.

  2. Add a separate data set for each entity. For example, to reference the Header entity, add a data set, name it Header, and set Variable Path to PriceRequest.Header.

  3. Add attributes to join the data sets.

Add another data set. For example, here's how you add the Charge data set.

how to add the Charge data set

Note

  • Keep adding data sets until you finish adding the ones you need to populate all entities and attributes in the service data object that the algorithm needs to finish the step.

    For example, make sure you populate attributes in conditions and actions that the step uses.

  • Use Move Up and Move Down in the Data Sets area to sequence data sets according to dependency. The algorithm processes data sets in the sequence that the Data Sets area displays them.

    For example, the algorithm must calculate charges before it can apply them to the order line. So, arrange data sets so the Charge data set is above the Line data set.

Tip: Use an application to create a diagram of your service data object, such as Microsoft Visio or Powerpoint. Refer to the diagram when you add data sets.

More Join Examples

Requirement

Data Set Join

Cardinality

Join one order line to one order header.

You match one attribute.

[HeaderId: {Line. HeaderId}]

An order line can exist only in one sales order, and a sales order includes only one header, so use.

  • One

  • Zero or one

Join a manual price adjustment to a charge.

You match more than one attribute.

An order can include more than one charge. You must specify all the attributes of the charge so your join can identify the correct charge to use.

[ParentEntityId: {Charge.ParentEntityId}, ParentEntityCode: {Charge.ParentEntityCode}, RollupFlag: {Charge.RollupFlag}, ChargeAppliesTo: 'PRICE']

More than one manual adjustment can exist for a charge, so set Cardinality to Many.

Another way to match a manual price adjustment to a charge.

Use a Groovy expression to match the ChargeDefinitionId or the ChargeDefinitionCode.

ERROR'!=Mpa.MessageTypeCode &&

(Charge.ChargeDefinitionCode==Mpa.ChargeDefinitionCode || Charge.ChargeDefinitionId==Mpa.ChargeDefinitionId) && Charge.PricePeriodicityCode==Mpa.PricePeriodicityCode && Charge.MessageTypeCode!='ERROR' &&

Charge.ParentEntityId==Mpa.ChargeParentEntityId && Charge.RollupFlag==Mpa.ChargeRollupFlag

Many

Create a new charge component.

You match one attribute.

[ChargeId: {Charge.ChargeId}]

Most service data objects already include a charge and charge component. If you create a new entity or charge component, then set Cardinality to Many so your join can identify the correct one.

Another Data Set Example

Here's a step that includes several typical data sets.

step that includes a typical data set

Note

  1. Name.

    Example

    Description

    Create Shipping Charges

    Text that describes the data set.

    Make sure the name is unique within the algorithm.

    Use camel case and make the first letter uppercase. For example, MyDataSet.

  2. Variable Path. An expression that specifies the source for the data set.

    Here's the format you use to create an expression that references a variable.

    • AlgorithmVariableName.Attribute

    where

    • AlgorithmVariableName identifies the name of an algorithm variable.

    • Attribute identifies an attribute of the service data object.

    Here's the expression that the Header data set uses in the example.

    • PriceRequest.Header

      The expression specifies to use the PriceRequest variable of this algorithm and the Header attribute of the service data object.

    Here's the format to use to create an expression that references a function.

    • algorithmFunctionName(argument1.argument2.argument3 . . .)

    For example:

    • checkAllowedCurrency(strategyId.currencyCode)

    This expression specifies to use the strategyId argument and the currencyCode argument of the checkAllowedCurrency function.

  3. Primary.

    • Contains a check mark. Use this row as the primary data set. Each algorithm step processes the set of records that the primary data set contains. You can set only one primary data set for each step.

    • Doesn't contain a check mark. Use this row as a nonprimary data set. A nonprimary data set filters the records that the primary data set processes.

  4. Cardinality. Specify the cardinality between the primary data set and the nonprimary data set.

    Cardinality

    Description

    One

    One primary data set to one nonprimary data set. Establishes an inner join.

    Zero or One

    Zero or one primary data sets to one nonprimary data set. Establishes an outer join.

    Many

    Zero or many primary data sets to one nonprimary data set.

  5. Data Set Join. Set up the join that the step uses to filter the nonprimary data set.

    For example, here's a data set join that filters the Line data set.

    • [LineId:{Candidate.ParentEntityId}]

    Note

    • Use a Groovy expression that evaluates to a Boolean value.

    • Use attributes from the nonprimary data set without a qualifier.

    • If you use a data set join, then you can't create an optimized index search, which might degrade performance.

    • If you reference a function in the variable path, then you can't use a data set join.

    If the expression is a literal string, then create a data set join. For example:

    • [ActiveFlag: 'Y', HeaderId:{Line.HeaderId}]

  6. Order By. Sort the records of the data set in ascending order or descending order, according to one or more columns. Here's the format you use.

    • AttributeName modifier, AttributeName2 modifier, and so on

    where

    • A comma separates each level of the sort.

    • modifier is (DESC|ASC) (NULLS FIRST|NULLS LAST)

    Consider this code.

    It does a three level sort.

    1. Sort the data set records in descending order according to NetPrice. It places records that contain a null value for NetPrice last.

    2. Sort records within the NetPrice sort according to the value of the Discount attribute in the sales order header in ascending order. It places records that contain a null value for Discount first.

    3. Sort records within the Discount sort according to the value of the NetPrice attribute in ascending order. It places records that contain a null value for NetPrice first.

    If you don't define a modifier, then Pricing uses Ascending.

  7. Candidate Data Set. Identify records that are candidates for processing in this algorithm step. Pricing comes predefined to use Candidate as the primary for most data sets.

    For example, if an Order Management user adds shipping charges to order line x, then this step will consider whether to apply shipping charges to order line x, depending on other factors that the algorithm considers, such as pricing strategy, pricing segment, and so on.

    Here are the attributes of the Candidate data set you can use.

    Attribute

    Description

    Variable Path

    Candidate uses the CandidateInt.ShippingChargeCandidate variable path.

    • CandidateInt. A variable of this pricing algorithm. It stores a value that determines whether the item is a candidate for a shipping charge.

    • ShippingChargeCandidate. An attribute of the service data object. It specifies whether the item is a candidate for shipping charges.

    Primary

    Candidate typically identifies the unfiltered set of records that this step processes, so Primary contains a check mark.

  8. ServiceParam Data Set. Pricing comes predefined to use ServiceParam to identify the service data object, and to identify the attributes of the service data object, that this step uses.

    Here are the values that ServiceParam uses in this example.

    Attribute

    Description

    Variable Path

    ServiceParam typically uses the PriceRequest.PricingServiceParameter variable path.

    • PriceRequest. A variable of this pricing algorithm. This variable references the Sales web service.

    • PricingServiceParameter. An attribute of the Sales web service.

    Primary

    Candidate is typically the primary, and it references nonprimary data sets, such as ServiceParam, to filter the primary data set. So Primary doesn't contain a check mark for a nonprimary data set.

    Cardinality

    Zero or One specifies that there is zero or one ServiceParam to each Candidate.

  9. Line Data Set. Pricing comes predefined to use Line to identify the attributes on the order lines that this step examines when it filters records in the primary data set.

    Here are the attributes that the Line data set uses in this example.

    Attribute

    Description

    Variable Path

    Line typically uses the PriceRequest.Line variable path.

    • PriceRequest. A variable of this pricing algorithm. This variable references the Sales service.

    • Line. An attribute of the service data object. It identifies an order line.

    Cardinality

    Zero or One specifies that there is zero or one Line to each Candidate.

    In this example, each Candidate can reference only a single order line, so the cardinality is one to one.

    This cardinality also applies to the header because an order line can reference only one header.

    Data Set Join

    Line typically uses the [LineId:{Candidate.ParentEntityId}] join.

    • LineId. Identifies the order line. For example, 101.

    • Candidate. References the Candidate data set of this step.

    • ParentEntityId.

  10. Header Data Set. Pricing comes predefined to use Header to identify the attributes on the order header that this step examines when it filters records in the primary record set.

    Here are the attributes that the Header data set uses in this example.

    Attribute

    Description

    Variable Path

    Header typically uses the PriceRequest.Header variable path.

    • PriceRequest. A variable of this pricing algorithm. This variable references the Sales service.

    • Header. An attribute of the service data object. It identifies an order header.

    Data Set Join

    Header typically uses the [HeaderId: {Line.HeaderId}] join.

    • HeaderId. An attribute that identifies the header. For example, 101.

    • Line. References the Line data set of this step.

    • HeaderId.

  11. Charge Data Set. Pricing comes predefined to use Charge to identify the charges that an order line references.

    Here are the attributes that the Charge data set uses in this example.

    Attribute

    Description

    Variable Path

    Charge typically uses the PriceRequest.Charge variable path.

    • PriceRequest. A variable of this pricing algorithm. This variable references the Sales service.

    • Charge. An attribute of the service data object. It identifies one or more shipping charges.

    Cardinality

    Charge specifies that there are many Candidates to one Charge.

  12. Local Variable. Define a variable for use only in the condition.

  13. Default Action. (Not shown in the illustration. Its below Local Variable on the Edit Algorithm page.) Use Groovy to create the condition to run when the flow doesn't meet any of the other conditions you set up.