Macro Expansion in Forms

Hey Guys


Can I just confirm that the reason this macro fails if used in document template is because it uses
$patient notation?

Macro 1

concat('Maintenance Fluids:',$fluid_maintenance,' ml/hr')
expr:if($patient.species='Canine',math:round(number( 132 * math:pow(party:getWeight($patient), (3 div 4)) div 24),0),math:round(number( 80 * math:pow(party:getWeight($patient), (3 div 4)) div 24),0))

It fails to expand when used in a form.  Works fine when used in a history note.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Macro Expansion in Forms

The $patient variable isn't accessible to reports. The equivalent is $OpenVPMS.patient. In a report however, you want to be careful about using $OpenVPMS variables, as these refer to whatever is currently selected in the application, which may be different to what a report is using.

An equivalent expression for use in reports would be:

[expr:if(openvpms:get(patient:get(), 'species.code')='CANINE', math:round(number( 132 * math:pow(patient:weight(patient:get()), (3 div 4)) div 24),0), math:round(number( 80 * math:pow(patient:weight(patient:get()), (3 div 4)) div 24),0))]

Syndicate content