How do I insert patient breed without it being in capitals
Submitted by gretalloyd on Fri, 17/09/2021 - 13:52
Hi,
I'm using the following expression in an email template:
', openvpms:get($patient,'name') ,' is a ', openvpms:get($patient,'age') ,' old ', openvpms:get($patient,'breed') ,'.
It is creating the following info. The breed is in all caps and has underscores.
Spike is a 9 Years old CROSSBRED_GERMAN_SHEPHERD_DOG.
is there something I need to edit in my expression to make it just normal text.
For bonus points, is there a way for it to say: 9 year (instead of 9 Years)?
Thanks,
Greta
Re: How do I insert patient breed without it being in capitals
You don't need to use the openvpms:get() form when you have a variable like $patient.
You can access the nodes directly: $patient.name etc, which is a little less verbose.
The openvpms:get($patient,'breed') call returns the breed code which is used to uniquely identify the breed.
To get the breed name, use $patient.breed
So the following should handle the your first query:
Your second query can be handled using toLowerCase() to convert 'Years' to 'year' followed by replaceAll() to remove the 's' e.g.:
-Tim
Re: How do I insert patient breed without it being in capitals
Thanks so much Tim