Hello,
I am trying to find the best way to return the number of weeks or months that have passed since a patients surgery date. We keep track of surgery dates with an obsterm and I need a form to populate the number of weeks or months passed since the last obsterm value. Any help would be appreciated.
Thanks!
There was a previous post here, that may be helpful.
https://centricityusers.com/?pa.....38;ret=all
There is also a function called DURATIONDAYS.
{DURATIONDAYS("1/11/1997","2/11/1997)}
returns 31
There is a function in the MEL manual that guides on calculating weeks using DIV and MOD commands.
I have looked at other posts using the DIV function to calculate weeks and have come up with the following with no luck.
{!document.weeks_po = div(durationdays(obsprev("dateofsurg"),str(document.clinicaldate)),7)}
Thanks!
Here is something from GE online help files:
A more complicated example that defines a function for calculating how many weeks a woman is pregnant based on last menstrual period:
{fn WEEKS_PREG(lmp)
{
LOCAL days
LOCAL preg
if lmp = "" then
return ""
else
days = DURATIONDAYS(lmp,str(._TODAYSDATE))
preg = div(val(days), 7) + " weeks"
if mod(val(days), 7) <> 0 then
preg = preg + " and " + mod(val(days), 7)
if mod(val(days), 7) = 1 then
preg = preg + " day"
else
preg = preg + " days"
endif
endif
endif
return preg
}
I am a beginner at writing functions and really don't know how to apply the above example to what I am needing, or how to call the function. Could you help point me in the right direction?
Thanks!