Interface IRebateRecordManager
- In a RebateAgreement/Compensation calculation (type codes 'RBA' / 'CO'), when the logic context's '
currentItem' is an individual line item (type codes 'RBALI' / 'COLI'). - In a RebateAgreement/Compensation 'read-only' evaluation (when opening an uneditable Rebate Agreement or Compensation); currentItem is 'RBALI'.
- In a RebateRecordSet/CompensationRecordSet calculation, the formula context's 'currentItem' is an individual RebateRecord (type codes 'RR / COR').
rebateRecords Groovy binding variable.
In Compensation Plan and Compensation Record logics, the binding variable is compensationRecords.
The methods that return a record return it as a map of its fields.
Context-specific Implementation Notes:
- Context 1 (Rebate Agreement/Compensations Calculations): Rebate Records / Compensation Records can only be added. The
setRank()method is only effective in this context. - Context 2 (Read-only Evaluations): Does not allow any modification (adding or updating Rebate Records (RR) / Compensation Records (COR)).
- Context 3 (RecordSet Calculations): Only allows updating existing Rebate Records (RR) / Compensation Records (COR) (through the
set(..)methods).
In Context 1, the records change only when the calculation generates them, for example when the agreement is saved. In other Context 1 runs, such as input generation, the methods that change records do nothing.
When the agreement is saved, Pricefx deletes the records of the line item that an earlier calculation generated and the logic no longer adds. Manual records, such as copies that users made, are kept. Add every record that the line item still needs in each calculation.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionCompensationAgreementRecordAdds a Rebate Record (RR) / Compensation Record (COR) in the specified Rebate Record Set / Compensation Record Set to the current Rebate Agreement / Compensation line item (RBALIorCOLI).CompensationAgreementRecordAdds a Rebate Record (RR) / Compensation Record (COR) with the specified name and attribute values to the current Rebate Agreement / Compensation line item (RBALI / COLI).CompensationAgreementRecordAdds a Rebate Record (RR) / Compensation Record (COR) with the default name and attribute values to the current Rebate Agreement / Compensation line item (RBALI / COLI).ResultCompensationAgreementRecordasLink()Return a clickable link to the RR/COR with the default name, as the result of a formula elementResultCompensationAgreementRecordReturn a clickable link to the RR/COR with the given name, as the result of a formula elementResultCompensationAgreementRecordReturn a clickable link to the RR/COR for the given name and RR/COR-set, as the result of a formula elementasResultMatrix(String... attributes) Return a ResultMatrix listing all RR/CORs in the agreement, optionally the fields/attributes to be shown as matrix columns.buildDataTableChart(String datamartName, String dateDimFieldName) Deprecated.CompensationAgreementRecordget()Get the RR/COR with the default name linked to the current RA/CO.lineitemCompensationAgreementRecordGet the RR/COR with the given name linked to the current RA/CO.lineitemCompensationAgreementRecordIn the given RR/COR-set, get the RR/COR with the given name linked to the current RA/CO.lineitemList<CompensationAgreementRecord> getAll()Get all RR/CORs linked to the current agreement (via RR/COR --> RLI/COLO --> RBA/CO).List<CompensationAgreementRecord> Get all RR/CORs linked to the line item with the given lineID in the current agreement (via RR/COR --> RLI/COLI).Get the formula element result for the RR/COR with the default name linked to the current RA/CO.lineitemGet the formula element result for the RR/COR with the given name linked to the current RA/CO.lineitemIn the given RR/COR-set, get the formula element result for the RR/COR with the given name linked to the current RA/CO.lineitembooleanSets fields of the Rebate Record (RR) / Compensation Record (COR) in the specified Rebate Record Set.booleanSets fields of the Rebate Record (RR) / Compensation Record (COR) with the specified name.booleanSets fields of the Rebate Record (RR) / Compensation Record (COR) with the default name.voidAssigns the rebate record specified by rebateRecordName to the rebate record group specified by groupName.voidAssigns the rebate record specified by rebateRecordName and recordSetLabel to the rebate record group specified by groupName.booleansetRank(int rank) Sets the rank on the default RR/COR.booleanSets the rank on the named RR/COR.
-
Method Details
-
add
Adds a Rebate Record (RR) / Compensation Record (COR) with the default name and attribute values to the current Rebate Agreement / Compensation line item (RBALI / COLI).See
add(String, Map[])for more details.Example:
rebateRecords.add([ "startDate" : "2026-01-01", "endDate" : "2026-03-31", "attribute1": out.Rebate, ])- Parameters:
attributeValues- Maps of field names to values. They override the values that the record gets from the line item.- Returns:
- The added or updated record if the calculation generates records, otherwise
null. - See Also:
-
add
Adds a Rebate Record (RR) / Compensation Record (COR) with the specified name and attribute values to the current Rebate Agreement / Compensation line item (RBALI / COLI).If the line item already has a record with this name in the Default Record Set, the method updates that record instead. The record gets the start date, end date, payout date and other fields of the line item. The map overrides these fields. The inputs of the record logic get the values of the line item and agreement header inputs with the same name.
Side effects:
- Record Set assignment:
- If the Record Set label is not specified (see
add(String, String, Map[])) the Rebate Record is automatically assigned to the "Default" Rebate Records Set.
- If the Record Set label is not specified (see
- Rebate Record Group assignment:
- If the value of
HeaderRebateType.recordWorkflowFormulaTarget("Rebate Record Workflow Object") of the RBA's Rebate Agreement Type is set toREBATERECORDGROUP(meaning that the group should go through a workflow), then the new Rebate Record will be automatically assigned to the Rebate Record Group. The name of the automatically created RRG consists of theuniqueNameandpayoutDateof the Rebate Agreement (RBA). - If the value of
HeaderRebateType.recordWorkflowFormulaTarget("Rebate Record Workflow Object") of the RBA's Rebate Agreement Type is set toREBATERECORD(meaning that the group will not go through a workflow), then the Rebate Record will not be assigned to a Rebate Record Group.
- If the value of
setGroup()method.Example:
rebateRecords.add("rr1", [ "startDate": "2021-09-01", "endDate": "2021-09-29", "attribute1": 10, "attribute2": 15, "attributeExtension___fieldName": "value", ])- Parameters:
recordName- The name of the Rebate Record / Compensation Record you want to add.attributeValues- A map of field names and values you want to add for the current RebateRecord table.- Returns:
- The added or updated record if the calculation generates records, otherwise
null. - See Also:
- Record Set assignment:
-
add
CompensationAgreementRecord add(String recordName, String recordSetLabel, Map<?, ?>... attributeValues) Adds a Rebate Record (RR) / Compensation Record (COR) in the specified Rebate Record Set / Compensation Record Set to the current Rebate Agreement / Compensation line item (RBALIorCOLI).If the line item already has a record with this name in this Record Set, the method updates that record instead.
Side effects:
- Record Set creation:
- If the Record Set with the specified label does not exist, it will be automatically created.
- Rebate Record Group automatic assignment:
- If the value of
HeaderRebateType.recordWorkflowFormulaTarget("Rebate Record Workflow Object") of the RBA's Rebate Agreement Type is set toREBATERECORDGROUP(meaning that the group should go through a workflow), then the new Rebate Record will be automatically assigned to the Rebate Record Group. The name of the automatically created RRG consists of theuniqueNameandpayoutDateof the Rebate Agreement (RBA). - If the value of
HeaderRebateType.recordWorkflowFormulaTarget("Rebate Record Workflow Object") of the RBA's Rebate Agreement Type is set toREBATERECORD(meaning that the group will not go through a workflow), then the Rebate Record will not be assigned to a Rebate Record Group.
- If the value of
setGroup()method.Example:
rebateRecords.add("rr1", "MyFirstRecordSet", [ "startDate": "2021-09-01", "endDate": "2021-09-29", "attribute1": 10, "attribute2": 15, "attributeExtension___fieldName": "value", ])- Parameters:
recordName- The name of the Rebate Record (RR) / Compensation Record (COR) you want to add.recordSetLabel- The label of the RebateRecordSet (RRS) or CompensationRecordSet (CORS) you want the Record to be assigned to. If the label does not exist, a new Record Set is created.attributeValues- The map of field names and values you want to add to the current RebateRecord / CompensationRecord.- Returns:
- The added or updated record if the calculation generates records, otherwise
null. - See Also:
- Record Set creation:
-
setRank
boolean setRank(int rank) Sets the rank on the default RR/COR. RR/CORs with a lower rank are calculated first within a given agreement.- Parameters:
rank- The rank to set.- Returns:
falseif the calculation generates records and the current line item has no record with the default name in the Default Record Set, otherwisetrue.- See Also:
-
setRank
Sets the rank on the named RR/COR. RR/CORs with a lower rank are calculated first within a given agreement.getAll()also returns the records sorted by rank.Example:
rebateRecords.add("Q1", ["startDate": "2026-01-01", "endDate": "2026-03-31"]) rebateRecords.add("Q2", ["startDate": "2026-04-01", "endDate": "2026-06-30"]) rebateRecords.setRank("Q1", 1) rebateRecords.setRank("Q2", 2)- Parameters:
recordName- The name of the record in the Default Record Set.rank- The rank to set.- Returns:
falseif the calculation generates records and the current line item has no record with this name in the Default Record Set, otherwisetrue.
-
setGroup
Assigns the rebate record specified by rebateRecordName to the rebate record group specified by groupName. If the group of that name does not exist, it will be created.This method works with Rebate Records only.
Example:
rebateRecords.add("Q1", ["attribute1": out.Rebate]) rebateRecords.setGroup("Q1", "Quarterly rebates")- Parameters:
rebateRecordName- The name of the Rebate Record in the Default Record Set.groupName- The name of the Rebate Record Group in the current Rebate Agreement.- Throws:
IllegalArgumentException- If the Condition Type of the Rebate Record selects no Rebate Record Group logic, or a different one than the Condition Type of the group.- See Also:
-
setGroup
Assigns the rebate record specified by rebateRecordName and recordSetLabel to the rebate record group specified by groupName. If the group of that name does not exist, it will be created.- Parameters:
rebateRecordName- The name of the Rebate Record.recordSetLabel- The label of the Record Set of the Rebate Record.groupName- The name of the Rebate Record Group in the current Rebate Agreement.- Throws:
IllegalArgumentException- If the Condition Type of the Rebate Record selects no Rebate Record Group logic, or a different one than the Condition Type of the group.- See Also:
-
getAll
List<CompensationAgreementRecord> getAll()Get all RR/CORs linked to the current agreement (via RR/COR --> RLI/COLO --> RBA/CO).Example:
def recordNames = rebateRecords.getAll().collect { it.name }- Returns:
- The records of the current agreement, sorted by rank.
- See Also:
-
getAll
Get all RR/CORs linked to the line item with the given lineID in the current agreement (via RR/COR --> RLI/COLI).- Parameters:
lineId- The line ID of a line item in the current agreement.- Returns:
- The records of that line item, sorted by rank, or
nullif the current agreement has no line item with this ID.
-
get
CompensationAgreementRecord get()Get the RR/COR with the default name linked to the current RA/CO.lineitem- Returns:
- The record with the default name in the Default Record Set, or
nullif there is none. - See Also:
-
get
Get the RR/COR with the given name linked to the current RA/CO.lineitemExample:
def record = rebateRecords.get("Q1") def rebate = record?.attribute1- Parameters:
recordName- The name of the record.- Returns:
- The record with this name in the Default Record Set, or
nullif there is none.
-
get
In the given RR/COR-set, get the RR/COR with the given name linked to the current RA/CO.lineitem- Parameters:
recordName- The name of the record.recordSetLabel- The label of the Record Set.- Returns:
- The record with this name in this Record Set, or
nullif there is none. - See Also:
-
set
Sets fields of the Rebate Record (RR) / Compensation Record (COR) with the default name.- Parameters:
attributeValues- Maps of field names to values.- Returns:
falseif a field does not exist on the record or cannot take the value, otherwisetrue. When no record matches or the context does not allow changes, the method changes nothing and returnstrue.- See Also:
-
set
Sets fields of the Rebate Record (RR) / Compensation Record (COR) with the specified name.Example:
rebateRecords.set("rr1", [ "attributeExtension___fieldName": "value", "attribute1" : 161.3, "attribute2" : "test", ])- Parameters:
recordName- The name of the Rebate Record or Compensation Record object you want to update.attributeValues- A map of field names and values you want to set for the current RebateRecord object.- Returns:
falseif a field does not exist on the record or cannot take the value, otherwisetrue. When no record matches or the context does not allow changes, the method changes nothing and returnstrue.
-
set
Sets fields of the Rebate Record (RR) / Compensation Record (COR) in the specified Rebate Record Set.- Parameters:
recordName- The name of the Rebate Record or Compensation Record object you want to update.recordSetLabel- The label of the Record Set of the record.attributeValues- A map of field names and values you want to set for the current RebateRecord object.- Returns:
falseif a field does not exist on the record or cannot take the value, otherwisetrue. When no record matches or the context does not allow changes, the method changes nothing and returnstrue.- See Also:
-
getResult
Get the formula element result for the RR/COR with the default name linked to the current RA/CO.lineitem- Parameters:
elementName- The name of the logic element.- Returns:
- The result of the element that is stored on the record, or
nullif the record or the result does not exist. - See Also:
-
getResult
Get the formula element result for the RR/COR with the given name linked to the current RA/CO.lineitemWhen
add(String, Map[])creates or updates the record, it clears the stored results of that record.Example:
def q1Rebate = rebateRecords.getResult("Q1", "Rebate")- Parameters:
recordName- The name of the record in the Default Record Set.elementName- The name of the logic element.- Returns:
- The result of the element that is stored on the record, or
nullif the record or the result does not exist.
-
getResult
In the given RR/COR-set, get the formula element result for the RR/COR with the given name linked to the current RA/CO.lineitem- Parameters:
recordName- The name of the record.recordSetLabel- The label of the Record Set.elementName- The name of the logic element.- Returns:
- The result of the element that is stored on the record, or
nullif the record or the result does not exist. - See Also:
-
asLink
ResultCompensationAgreementRecord asLink()Return a clickable link to the RR/COR with the default name, as the result of a formula element- Returns:
- The link, or
nullif there is no such record. Return it as the result of a logic element. - See Also:
-
asLink
Return a clickable link to the RR/COR with the given name, as the result of a formula elementExample:
return rebateRecords.asLink("Q1")- Parameters:
recordName- The name of the record in the Default Record Set.- Returns:
- The link, or
nullif there is no such record. Return it as the result of a logic element.
-
asLink
Return a clickable link to the RR/COR for the given name and RR/COR-set, as the result of a formula element- Parameters:
recordName- The name of the record.recordSetLabel- The label of the Record Set.- Returns:
- The link, or
nullif there is no such record. Return it as the result of a logic element. - See Also:
-
asResultMatrix
Return a ResultMatrix listing all RR/CORs in the agreement, optionally the fields/attributes to be shown as matrix columns.The first column,
ID, holds the unique name of each record. The other columns follow the order ofattributes.Example:
return rebateRecords.asResultMatrix("attribute1", "attribute2")- Parameters:
attributes- The names or labels of the fields to show as columns, for exampleattribute1. A name that matches no field or label gives an empty column.- Returns:
- The matrix, with one row per record. Return it as the result of a logic element.
-
buildDataTableChart
Deprecated.Useapi.newChartBuilder().newDataTable()instead.- Parameters:
datamartName- The name of the Datamart.dateDimFieldName- The name of the date dimension field in the Datamart.- Returns:
- The Data Table chart.
-
api.newChartBuilder().newDataTable()instead.