# JPMC-PDP Documentation from https://developer.payments.jpmorgan.com # Advanced customizations In addition to the standard attributes provided by the various report types, you can customize reports with the following capabilities. **Advanced customization capabilities** | Customization capability | Description | | --- | --- | | Alias | Assign a custom attribute name instead of using the name provided by default. | | Aggregate Operation Text | Aggregate report data fields. | | Custom Calculation | Calculate the percent of another field. | | Group By | Group the selected fields from configuration. This is only applied to calculate customCalculation. | ## Alias Alias renames the column in the output report. This is particularly useful for backwards compatibility with systems expecting a different name, or to ensure compatibility with internal nomenclature. You must use alias with aggregate fields and custom calculation fields. The following example renames the `Payment Method Code` column to `MOP`: ```json { ... "reportSections": { "sectionSelectedFields": { "reportAttributeName": "Payment Method Code", "alias": "MOP" } } } ``` ## Aggregate operation text The `aggregateOperationText` function provides the ability to aggregate values in the data set. It supports `count`, `distinctCount`, `avg`, `min`, `max`, and `sum`. > A "group by" is applied implicitly on any attribute added on the report configuration that does not have an aggregate operator applied to it. This means identical attributes without aggregate operators are grouped together. > The following example sums the `Transaction Amount` column and renames to `Transaction Amount Total`: ```json { ... "reportSections": { "sectionSelectedFields": { "reportAttributeName": "Transaction Amount", "alias": "Transaction Amount Total", "aggregateOperationText": "sum" } } } ``` ### Aggregate condition text The `aggregateConditionText`** **function can specify conditions for using the `aggregateOperationText`. > Conditional aggregation is only applied when the `conditionalAggregateIndicator`** **value is set to `true`. > > The following example sums the `Funds Transfer Amount` column if the record's `Charge Category Type Name` equals either “Sale” or “Refund”: ```json { ... "reportSections": { "sectionSelectedFields": { "reportAttributeName": "Funds Transfer Amount", "alias": "Net Settled Deposit", "aggregateOperationText": "sum", "conditionalAggregateIndicator": true, "aggregateConditionAttributeName": "Charge Category Type Name", "aggregateConditionText": "IN(\"Sale\",\"Refund\")" } } } ``` ### Conditional aggregate subsection The `conditionalAggregateSubSection` function provides the ability to use multiple operators in conditional aggregation text. Operators supported are **AND **and **OR**. This requires the following fields in the configuration: **Required fields for conditional aggregate** | Field name | Description | | --- | --- | | conditionalAggregateInnerConditionList | Provides a list of sub-conditions. These sub-conditions are joined using conditionalAggregateInnerOperator specified in the configuration. Multiple conditionalAggregateInnerConditionLists are allowed and each innerConditionList can specify the operator (AND or OR) specific to that inner list. | | conditionalAggregateGlobalOperator | Operator to be applied, either OR or AND. This is used as a global operator to join different inner sections. | | conditionalAggregateInnerOperator | Operator to be applied, either OR or AND. This is used as a joining operator between filters within the inner section. | ```json { "reportAttributeName": "Settled Total Fee Amount", "alias": "Others", "aggregateOperationText": "sum", "conditionalAggregateIndicator": true, "conditionalAggregateSubSection": { "conditionalAggregateGlobalOperator": " OR ", "conditionalAggregateSubConditionList": [ { "conditionalAggregateInnerOperator": " AND ", "conditionalAggregateInnerConditionList": [ { "aggregateSubConditionAttributeName": "chargeCategoryCode", "aggregateSubConditionText": "IN(\"IA\")" }, { "aggregateSubConditionAttributeName": "chargeSubCategoryText", "aggregateSubConditionText": "IN (\"Assessment Fees\",\"Cross Border Assessment Fees\")" } ] }, { "conditionalAggregateInnerOperator": " AND ", "conditionalAggregateInnerConditionList": [ { "aggregateSubConditionAttributeName": "chargeCategoryCode", "aggregateSubConditionText": "IN(\"IA\")" }, { "aggregateSubConditionAttributeName": "chargeSubCategoryText", "aggregateSubConditionText": "IN (\"Assessment Fees\",\"Cross Border Assessment Fees\")" } ] }, { "conditionalAggregateInnerOperator": " AND ", "conditionalAggregateInnerConditionList": [ { "aggregateSubConditionAttributeName": "chargeCategoryCode", "aggregateSubConditionText": "IN(\"IA\")" }, { "aggregateSubConditionAttributeName": "chargeSubCategoryText", "aggregateSubConditionText": "IN (\"Assessment Fees\",\"Cross Border Assessment Fees\")" } ] } ] } } ``` > The **OR** operation is allowed only when `conditionalAggregateSubSection` is available in configuration. If `conditionalAggregateSubSection` does not exist, the **AND** operator is used by default. > ## Custom calculation The custom calculation feature currently supports the ability to provide "**% of total**" calculations. This requires the following fields in the configuration: **Required fields for custom calculation** | Field name | Description | | --- | --- | | customCalculationText | Operator to be applied "% of". | | customCalculationOn | Attribute to which the calculation is applied. | | groupBy | Attributes to group by for the % of calculation. | The following example would read: "Calculate the transaction count percentage of total within the payment method code and settlement currency code." > The **txn count** field referenced below is also a custom field applying the **count** aggregate operator as previously shown. > ```json { "alias": "Transaction Count %", "customCalculationText": "% of", "customCalculationOn": "Txn count", "groupBy": [ "Payment Method Code", "Settlement Currency Code" ] } ``` ## Additional custom calculations Additional custom calculation features supported are subtraction (diff) and division (div). This requires the following fields in the configuration: **Required fields for additional custom calculation** | Field name | Description | | --- | --- | | customCalculationText | Operator to be applied, either diff or div. | | customCalculationOn | Attribute to which the calculation is applied. | The following example identifies the `Count of First Chargebacks`** **divided by `Count of Sales` to provide the percent of first chargebacks to sales: ```json { "alias": "% of First Chargebacks to Sales", "customCalculationText": "Div", "customCalculationOn": "Count of First Chargebacks,Count of Sales" } ``` ## Related