Background
If no upgrade mappings were set, the “Calculation Upgrades” mechanism would ONLY do a 1:1 copy of:- [
referenceIdin old template version] → [referenceIdin new template version]
Basic Structure
Key Parameters
Custom Functions
Available Functions
function
Returns: boolean
Check whether a widget with given refId exists
Check whether a widget with given refId exists
function
Returns: string
Get the user inputted value
Get the user inputted value
function
Returns: string
The type of a cell (e.g., input, lookup)
The type of a cell (e.g., input, lookup)
function
Returns: object/matrix
Replace strings in nested keys/arrays
Replace strings in nested keys/arrays
function
Returns: boolean
Reverses the boolean value
Reverses the boolean value
Mapping Types
Simple Widget Mapping
Map one widget to another with the same value:Conditional Mapping
Map different old widgets to the same new widget:SharedTable Mapping
Map lookup values from old to new sharedTables:Table Mapping
Complex Table Transformations
When mapping tables with structural changes (e.g., adding columns), use theiterate function:
Example: Adding a Column
Complete Example Code
Complete Example Code
Lookup Widget Mapping
Mapping to New Lookup Values
Lookup to SharedTable Mapping
When mapping from a lookup widget to a sharedTable, you need entries in bothsharedTables and mappings:
Best Practices
1
Order Matters
Remember that mappings execute in order - earlier mappings can affect later ones
2
Test Thoroughly
Always test upgrade mappings with real user data
3
Document Changes
Keep clear documentation of what each mapping does
4
Handle Edge Cases
Consider null values, empty tables, and missing widgets
Ignore List
List referenceIds that should be ignored during upgrade:“Ignore” only affects equation mappings - it has no effect on sharedTable mappings. Also, if you’ve included a mapping from a deprecated id to a new one, you don’t need to repeat it in the ignore section.