Modify Algorithm When Using Matrix
If you modify the result column of a pricing matrix or use an extensible flexfield with a pricing matrix, then you must modify an algorithm step.
Assume you add an extensible flexfield to a discount adjustment. Here's the set up you need to do.
-
Click Tasks > Manage Algorithms.
-
On the Manage Algorithms page, search for, then open the algorithm you must edit.
If You Use This Matrix Type
Then Modify This Algorithm Step
In This Pricing Algorithm
Pricing Segment
Derive Pricing Segment
Get Sales Pricing Strategy
Sales Pricing Strategy Assignment
Get Header Strategy
Get Sales Pricing Strategy
Price List Charge Adjustment
Discount Adjustment
Pricing Term Adjustment
Evaluate Pricing Matrices
Apply Matrices
Line Strategy
Get Pricing Strategy
Get Line Pricing Strategy
Pricing Charge Guideline
Evaluate Pricing Matrices
Apply Matrix Rules for Guidelines
Pricing runs the predefined step at run time to process the pricing matrix.
For this example, search for, then open
Apply Matrices
for editing. -
On the Edit Algorithm page, click the step that contains
Evaluate Pricing Matrices
in the Name column. -
In the Step Details area, click the step that contains Matrix in the Name Column, then examine the code in the Variable Path column.
finest {'DynamicMatrixId: '+MatrixQ.DynamicMatrixId}; dynamicMatrix(MatrixQ.DynamicMatrixId, Line.PricingDate, ServiceParam.CacheEnabledFlag != null ? ServiceParam.CacheEnabledFlag : true)
Here's the format of the path to the Matrix data set.
dynamicMatrix(MatrixId, effectivityDate, enableCache)
where
Parameter
Description
MatrixId
Identifies the pricing matrix to evaluate.
effectivityDate
Date to compare against the start date and end date of the pricing matrix.
enableCache
Contains.
-
True. Cache the matrix rules.
-
False. Don't cache.
Most steps come with other predefined data sets, such as.
-
Charge
-
Line
-
Header
-
LineAttribute
-
ItemExtensibleAttribute
-
ServiceParam
To reduce maintenance, use a predefined data set. If none of the predefined data sets meet your needs, then add a new one.
If you use an item extensible attribute or extensible flexfield in a condition column, then you must add a data set. For example, here's a data set you could use to support an extensible flexfield that you add on the order header.
Name
Variable Path
Cardinality
Data Set Join
PricingHdrEFF_Custom
PriceRequest.Name
where
-
Name is identical to the data set name.
For this example.
PriceRequest.PricingHdrEFF_Custom
Zero or one
[HeaderIdCustom:{Header.HeaderId}]
-
-
In the Step Details area, scroll down, locate the First Row Actions section, then examine the code.
-
The algorithm runs this code for the first record that the query returns.
-
Pricing runs this code for each pricing matrix type except for the pricing guideline. It runs the Each Row Action for the pricing guideline.
-
Keep these points in mind during setup, maintenance, and troubleshooting.
-
Here's the complete code for the first row action. You must modify it in some situations. For details, see Manage Pricing Algorithms.
finest('Processing Matrix RuleId: '+Matrix.DynamicMatrixRuleId)
MatrixQ.AdjustmentBasisId = Matrix.AdjustmentBasisId
MatrixQ.AdjustmentValue = Matrix.AdjustmentAmount
MatrixQ.AdjustmentTypeCode = Matrix.AdjustmentTypeCode
MatrixQ.DynamicMatrixRuleId = Matrix.DynamicMatrixRuleId
MatrixQ.ConditionString = Matrix.MatchConditions.join(' ')
MatrixQ.ResultString = Matrix.MatchResults.join(' ')
/*if ( Matrix.AdjustmentTypeCode?.contains('PERCENT') )
Basis = (BasisComp.locate([PriceElementCode:Matrix.AdjustmentBasis]))?.UnitPrice?.Value
finest('Basis Value: ' + Basis)
MatrixQ.AdjustmentValue = pricingUtil.computeUnitAdjustment(Matrix.AdjustmentTypeCode, Basis, Matrix.AdjustmentAmount, Charge.RunningUnitPrice?:0)
MatrixQ.DynamicMatrixRuleId = Matrix.DynamicMatrixRuleId
// currency conversion
if (MatrixQ.FromCurrencyCode!=Charge.CurrencyCode ) {
if ( 'ERROR'==ConvRate?.MessageTypeCode ) {
finest('creating line message')
Line.MessageTypeCode = 'ERROR'
Charge.MessageTypeCode = 'ERROR'
Term.MessageTypeCode = 'ERROR'
msg = Message.locate([ParentEntityCode:'LINE',ParentEntityId:Line.LineId,MessageText:ConvRate.PrcErrorMessage])
if ( msg==null ) {
// create new error message for Line
msg = Message.insert([PricingMessageId:getNextId()])
msg.MessageName = ConvRate.PrcMessageName
msg.MessageText = ConvRate.PrcErrorMessage
msg.ParentEntityCode = 'LINE'
msg.ParentEntityId = Line.LineId
msg.MessageTypeCode = ConvRate.MessageTypeCode
}
}
else {
MatrixQ.AdjustmentValue *= ConvRate.ConversionRate?:1
finer('\tConverted currency, 1 '+MatrixQ.FromCurrencyCode+' = '+ConvRate.ConversionRate?:1+' '+Charge.CurrencyCode)
}
}
// end currency conversion
*/