...
Below is a sample code snippet for registering custom Expression within your custom frontend (esm)
Code Block | ||
---|---|---|
| ||
// Sample Test Function: function AgeCalculator(birthYear, currentYear) { return currentYear - birthYear; } // Registering the function (index.ts) export function startupApp() { registerExpressionHelper('customAgeCalc', AgeCalculator); } |
Referencing Patient Attributes in custom expressions
In scenarios where you want to dynamically pass patient data to an expression, the form engine also supports referencing patient attributes directly in your form json. For example you can reference the patient uuid using `patient.id`.
Code Block |
---|
"calculate": { "calculateExpression": "customPatientExpression(patient.id, 'sample-second-parameter-or-uuid').then(value => value)" }, |
Registering a custom datasource:
...