Interface IRebateRecordManager


public interface IRebateRecordManager
The RebateRecordManager API is exposed to Groovy logic elements in the following contexts:
  1. In a RebateAgreement/Compensation calculation (type codes 'RBA' / 'CO'), when the logic context's 'currentItem' is an individual line item (type codes 'RBALI' / 'COLI').
  2. In a RebateAgreement/Compensation 'read-only' evaluation (when opening an uneditable Rebate Agreement or Compensation); currentItem is 'RBALI'.
  3. In a RebateRecordSet/CompensationRecordSet calculation, the formula context's 'currentItem' is an individual RebateRecord (type codes 'RR / COR').
The API can be accessed via the 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 Type
    Method
    Description
    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 (RBALI or COLI).
    CompensationAgreementRecord
    add(String recordName, Map<?,?>... attributeValues)
    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).
    CompensationAgreementRecord
    add(Map<?,?>... attributeValues)
    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).
    ResultCompensationAgreementRecord
    Return a clickable link to the RR/COR with the default name, as the result of a formula element
    ResultCompensationAgreementRecord
    asLink(String recordName)
    Return a clickable link to the RR/COR with the given name, as the result of a formula element
    ResultCompensationAgreementRecord
    asLink(String recordName, String recordSetLabel)
    Return a clickable link to the RR/COR for the given name and RR/COR-set, as the result of a formula element
    asResultMatrix(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.
    CompensationAgreementRecord
    get()
    Get the RR/COR with the default name linked to the current RA/CO.lineitem
    CompensationAgreementRecord
    get(String recordName)
    Get the RR/COR with the given name linked to the current RA/CO.lineitem
    CompensationAgreementRecord
    get(String recordName, String recordSetLabel)
    In the given RR/COR-set, get the RR/COR with the given name linked to the current RA/CO.lineitem
    List<CompensationAgreementRecord>
    Get all RR/CORs linked to the current agreement (via RR/COR --> RLI/COLO --> RBA/CO).
    List<CompensationAgreementRecord>
    getAll(String lineId)
    Get all RR/CORs linked to the line item with the given lineID in the current agreement (via RR/COR --> RLI/COLI).
    getResult(String elementName)
    Get the formula element result for the RR/COR with the default name linked to the current RA/CO.lineitem
    getResult(String recordName, String elementName)
    Get the formula element result for the RR/COR with the given name linked to the current RA/CO.lineitem
    getResult(String recordName, String recordSetLabel, String elementName)
    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
    boolean
    set(String recordName, String recordSetLabel, Map<?,?>... attributeValues)
    Sets fields of the Rebate Record (RR) / Compensation Record (COR) in the specified Rebate Record Set.
    boolean
    set(String recordName, Map<?,?>... attributeValues)
    Sets fields of the Rebate Record (RR) / Compensation Record (COR) with the specified name.
    boolean
    set(Map<?,?>... attributeValues)
    Sets fields of the Rebate Record (RR) / Compensation Record (COR) with the default name.
    void
    setGroup(String rebateRecordName, String groupName)
    Assigns the rebate record specified by rebateRecordName to the rebate record group specified by groupName.
    void
    setGroup(String rebateRecordName, String recordSetLabel, String groupName)
    Assigns the rebate record specified by rebateRecordName and recordSetLabel to the rebate record group specified by groupName.
    boolean
    setRank(int rank)
    Sets the rank on the default RR/COR.
    boolean
    setRank(String recordName, int rank)
    Sets the rank on the named RR/COR.
  • Method Details

    • add

      CompensationAgreementRecord add(Map<?,?>... attributeValues)
      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

      CompensationAgreementRecord add(String recordName, Map<?,?>... attributeValues)
      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:

      1. 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.
      2. Rebate Record Group assignment:
        • If the value of HeaderRebateType.recordWorkflowFormulaTarget ("Rebate Record Workflow Object") of the RBA's Rebate Agreement Type is set to REBATERECORDGROUP (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 the uniqueName and payoutDate of the Rebate Agreement (RBA).
        • If the value of HeaderRebateType.recordWorkflowFormulaTarget ("Rebate Record Workflow Object") of the RBA's Rebate Agreement Type is set to REBATERECORD (meaning that the group will not go through a workflow), then the Rebate Record will not be assigned to a Rebate Record Group.
      Note: To assign the Rebate Record (RR) to the specific group (RRG), use the 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:
    • 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 (RBALI or COLI).

      If the line item already has a record with this name in this Record Set, the method updates that record instead.

      Side effects:

      1. Record Set creation:
        • If the Record Set with the specified label does not exist, it will be automatically created.
      2. Rebate Record Group automatic assignment:
        • If the value of HeaderRebateType.recordWorkflowFormulaTarget ("Rebate Record Workflow Object") of the RBA's Rebate Agreement Type is set to REBATERECORDGROUP (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 the uniqueName and payoutDate of the Rebate Agreement (RBA).
        • If the value of HeaderRebateType.recordWorkflowFormulaTarget ("Rebate Record Workflow Object") of the RBA's Rebate Agreement Type is set to REBATERECORD (meaning that the group will not go through a workflow), then the Rebate Record will not be assigned to a Rebate Record Group.
      Note: To assign the Rebate Record (RR) to the specific group (RRG), use the 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:
    • 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:
      false if the calculation generates records and the current line item has no record with the default name in the Default Record Set, otherwise true.
      See Also:
    • setRank

      boolean setRank(String recordName, int rank)
      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:
      false if the calculation generates records and the current line item has no record with this name in the Default Record Set, otherwise true.
    • setGroup

      void setGroup(String rebateRecordName, String groupName)
      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

      void setGroup(String rebateRecordName, String recordSetLabel, String groupName)
      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

      List<CompensationAgreementRecord> getAll(String lineId)
      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 null if 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 null if there is none.
      See Also:
    • get

      CompensationAgreementRecord get(String recordName)
      Get the RR/COR with the given name linked to the current RA/CO.lineitem

      Example:

      
       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 null if there is none.
    • get

      CompensationAgreementRecord get(String recordName, String recordSetLabel)
      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 null if there is none.
      See Also:
    • set

      boolean set(Map<?,?>... attributeValues)
      Sets fields of the Rebate Record (RR) / Compensation Record (COR) with the default name.
      Parameters:
      attributeValues - Maps of field names to values.
      Returns:
      false if a field does not exist on the record or cannot take the value, otherwise true. When no record matches or the context does not allow changes, the method changes nothing and returns true.
      See Also:
    • set

      boolean set(String recordName, Map<?,?>... attributeValues)
      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:
      false if a field does not exist on the record or cannot take the value, otherwise true. When no record matches or the context does not allow changes, the method changes nothing and returns true.
    • set

      boolean set(String recordName, String recordSetLabel, Map<?,?>... attributeValues)
      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:
      false if a field does not exist on the record or cannot take the value, otherwise true. When no record matches or the context does not allow changes, the method changes nothing and returns true.
      See Also:
    • getResult

      Object getResult(String elementName)
      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 null if the record or the result does not exist.
      See Also:
    • getResult

      Object getResult(String recordName, String elementName)
      Get the formula element result for the RR/COR with the given name linked to the current RA/CO.lineitem

      When 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 null if the record or the result does not exist.
    • getResult

      Object getResult(String recordName, String recordSetLabel, String elementName)
      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 null if 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 null if there is no such record. Return it as the result of a logic element.
      See Also:
    • asLink

      ResultCompensationAgreementRecord asLink(String recordName)
      Return a clickable link to the RR/COR with the given name, as the result of a formula element

      Example:

      
       return rebateRecords.asLink("Q1")
       
      Parameters:
      recordName - The name of the record in the Default Record Set.
      Returns:
      The link, or null if there is no such record. Return it as the result of a logic element.
    • asLink

      ResultCompensationAgreementRecord asLink(String recordName, String recordSetLabel)
      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 null if there is no such record. Return it as the result of a logic element.
      See Also:
    • asResultMatrix

      ResultMatrix asResultMatrix(String... attributes)
      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 of attributes.

      Example:

      
       return rebateRecords.asResultMatrix("attribute1", "attribute2")
       
      Parameters:
      attributes - The names or labels of the fields to show as columns, for example attribute1. 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 ChartBuilderResult buildDataTableChart(String datamartName, String dateDimFieldName)
      Deprecated.
      Parameters:
      datamartName - The name of the Datamart.
      dateDimFieldName - The name of the date dimension field in the Datamart.
      Returns:
      The Data Table chart.