OpenMRS Distro Reference Application Docker version 3.x:
How can I use the historicalExpression to auto-populate question fields in the ampath-forms:
Hello,
I’m currently facing a challenge while attempting to use the historicalExpression
to auto-populate values from one form to another in OpenMRS3.x ampath forms. Specifically, I have two forms named ‘TB Testing Form’ and ‘TB Follow-Up Form.’ My goal is to automatically populate the questions in the ‘TB Follow-Up Form’ with values from the ‘TB Testing Form.’
I’ve attempted to use the historicalExpression
,
"historicalExpression": "_.isEmpty(HD.getObject('prevEnc').getValue('0b49e3e6-55df-4096-93ca-59edadb74b3f')) ? undefined : HD.getObject('prevEnc').getValue('0b49e3e6-55df-4096-93ca-59edadb74b3f')"
but it seems to only work when I’ve already submitted the ‘TB Follow-Up Form.’ However, my requirement is to auto-populate from the ‘TB Testing Form’ even before submitting the ‘TB Follow-Up Form.’
As I was trying, I realized that you can’t auto-populate fields from a different encounter. For the historicalExpression to work, it has to be that encounter.
How can I achieve this?