Plasma Transactions PreviousPrice & Exchange - Upgrade Areas 1.4 -> 1.5.2
Scope of the modifications: Plasma_Transactions_PreviousPrice and Plasma_Transactions_Exchange logics.
Goal: Handle multi-currency transactions process (i.e. previous transaction and current transaction are in different currencies – a particular product was sold to a particular customer in different currencies).
Key Changes: Additional separate field in DataSource (DS.Plasma_Transactions) for previous transaction assignment (PreviousCurrency) and the logic’s behavior changes (described below).
In this section:
Flow
Modifications
DataSource Structure (DS.Plasma_Transactions)
New field added: PreviousCurrency
DataType: String (as two fields with the Currency type are not accepted/allowed in the fields area)
Process Flow
All currencies from the Plasma_Transactions logic are uploaded into the Currency fields in DS.Plasma_Transactions.
The Plasma_Transactions_PreviousPrice logic updates the PreviousCurrency field with an appropriate currency type.
The Plasma_Transactions_Exchange logic converts the currency to the default one through Currency or PreviousCurrency (applying appropriate exchange rate depending on the column type – previous or not).
Plasma_Transactions_PreviousPrice
DataLoad modifications:
FormulaInput to SourceFieldMapping: Input (Currency) and Field (Currency)
FormulaOutputs to TargetFields (ticked): Name (PreviousCurrency) and Label (PreviousCurrency)
CalculationLogic modifications:
New formula Currency.formula:
UserEntry("Currency")
New script PreviousCurrency.groovy:
return out.PreviousRow?.getAt('Currency')
Plasma_Transactions_Exchange
DataLoad modifications:
FormulaFixedInputs: PreviousCurrency
FormulaInput to SourceFieldMapping: PreviousCurrency (without field)
CalculationLogic modifications:
New formula PreviousCurrency.formula:
StringUserEntry("PreviousCurrency")
Warnings from PreviousCurrency field were hidden, as null is present each time there is no previous transaction.
Exchange script was removed and its features were integrated with the Library script.
Separate exchange rates selection (by PricingDate for the current transaction and PreviousPricingDate for the previous transaction).
Modification of the Library method (applyConversionRate) to take exchange rate and currency type as an argument:
applyConversionRate(fieldName, pricingDateFieldName, currencyFromFieldName)
Modification of each column’s scripts to take an appropriate pricing date type (PricingDate or PreviousPricingDate) and currency type (Currency or PreviousCurrency).
Edge Conditions Behavior
If the currency is not found (in DS.ccy or DS.Plasma_Currency), an exception is thrown (by WarningManager feature) and the row is skipped for the further calculations flow.