diff --git a/src/utils/common-expression-helpers.ts b/src/utils/common-expression-helpers.ts index 34c91c8f8..5f5a50f05 100644 --- a/src/utils/common-expression-helpers.ts +++ b/src/utils/common-expression-helpers.ts @@ -280,6 +280,17 @@ export class CommonExpressionHelpers { return daySinceLastObs === '' ? '0' : daySinceLastObs; }; + generateInfantPTrackerId = (fieldId: string, motherPtrackerId: string): string | undefined => { + if (!fieldId || !motherPtrackerId) return; + + return fieldId === 'infantPtrackerid' + ? motherPtrackerId + '1' + : fieldId.includes('_') + ? motherPtrackerId.concat(fieldId.split('_')[1]) + : undefined; + }; + + /** * Used as wrapper around async functions. It basically evaluates the promised value. */