The calculation has to be done in the same BahmniObsValueCalculator. If you look at the Bahmni-Core code, BahmniObsValueCalculator is specifically loaded using its name. Hence this restriction.
The way we do it right now is to have multiple CalculateXXX() Methods and call them.
Please have a look at the example.
I realy need you help on auto-calculate from two date time.
i want to auto-calculate total surgical time spend from surgical time in and surgical time out and these fields are datetime.
I tried to follow the same auto-calculate done in bahmni for BMI but i don’t know why it doesn’t show the auto-calculated value. i also tried to use this approach for debugging Debug groovy file but it doesn’t debug.
see my groovy file code here: my groovy file,
Kindly help
Do you have the Concept ‘Surgical Total Time’ created under the same parent of Surgical Time In/Out?
Looking at the groovy, i see that you are just setting value, but when you are saving Surgical Time In/Out observations for the first time, there won’t be any Surgical Total Time obs right. Hence you need to create an observation using ‘createObs’ method for it and set the value and set it as one of the children of your parent concept.
I have followed your advice but it seems there is something i’m messing up, i have created the obs using
createObs as you suggested and set a static value to the surgical total time fields. But that static value is not showing up when i save the form data, even the debug code don’t write in the file. it seems this file is not executing my code.
Hi @mupagasi, if you’re looking to display surgical total time on the form itself, I’m not sure if Bahmni supports that. You would need to display it on the patient dashboard.
Thanks for the information but for me it 's inevitably to have this kind of
auto-calculated fields, can you guide me how i can display this
auto-calculated field on patient dashboard, or my be share your
configurations if you don’t mind.