how can i use this for a quick text?
put the function in C:\Program Files\Centricity EMR 9.5\mellib.txt and put one of the 4 function calls in a quicktext.
I'm sure this is a really dumb question, but my brain is *fried*
I copied the above function and pasted it into notepad first then into a new letter template in CPS. When I access the letter in a patient's chart, the letter output is the entire function , everything in between the "{" "}" !
I know you can place and call functions from a letter... What am I doing wrong?
not sure...work with EMR, not CPS...but should work...do you get an error?
No error, and here's where it gets even more weird:
- The function will work if I place it in the mellib.txt file and call it in quick-text.
- Any/all other functions are working properly in letters/handouts in CPS
- NO errors, I just see ALL the text including the function and its call
- Any other functions I place in the same letter (such as {NEXT_APPT()}) will work.
??? !!!
when you copied to/pasted from Notepad, did you make sure Wrap was off?
Yes, Wrap was off, although I had no idea that could cause issues..
Could it be that it is because it is accessing non-typical functions/data symbols? For instance: GETROWCOUNT("_MELCurPatientAppt") <-- I cannot find either of those documented anywhere in either CPS or VFE. I would not have even known they existed had I not seen your formula... Where do these come from? Are these accessing Oracle directly?
Is it possible to display all the elements associated with an appointment from the data symbol referenced in this function? I would like to modify/create a function that displays upcoming appointments for specific providers, not just "me" or "all", I just do not understand how to access the raw data...
I would try copying the function back into Notepad, with Wrap off, and combine lines of code that look like they're on 2 lines...funky character at end of line may confuse Centricity.
Both the GETROWCOUNT function and the _MEL... view come from mellib.txt, or maybe one of the meldef files. Yes, directly.
You can display whatever elements are returned from the view. These are things that users can't change, only reference.
Now I am finding that changing the 12 to 11 in the mellib.txt file doesn't always work, two of our appts are supposed to be 12:15 pm and say 0:15 pm. I reported it to GE before but they said everyone has the 11 not the 12, of course that was back when I thought it was working.
Adding those 2 lines should not affect the time calc, just the am/pm part. I did notice that the 3 lines in red below should be moved up as shown.
fn appttime(time) {
local ampm = 'am'
local dhours = time/3600
local hours = truncate(dhours)
local dmin = (dhours – hours)*60
local min = round(dmin)
local smin = str(min)
if (hours > 11) then
ampm = 'pm'
endif
if (hours > 12) then
hours = hours – 12
endif
if size(smin) <= 1 then smin = '0'+smin endif
hours + ':' + smin + ' ' + ampm
}
That does work thanks. Now GE is saying their original file with the 12 is what we should use, I think they are confused.
Where are you guys calling the appt function?
In our patient banner, I use my old one that I had put in the the usrlib.txt file:
{SMRMC_APPT_ALL_FUTURE()}
this works as it should now that the mellib.txt file is fixed. I pasted it below. My hospital is SMRMC so you could change that part on yours.
//APPT (ALL FUTURE) FUNCTION
fn SMRMC_APPT_ALL_FUTURE() {
//lists all future appts with a comma between fields a hret between records
//use nested getfields to turn in to a 2D array if you want to pick elements
//DN--3-31-04 modified from mellib stock function
local a, b,c, loc, atype, book, i = 0
local result=''
local j = getRowCount('_MELCurPatientAppt')
// Loop thru patients appointments
if j == 1 then a = getRow('_MELCurPatientAppt',0, 'ApptDate',
'ApptTime','Appttype','Booklist','ApptStatus')
// Find the next appointmnet
if val(a[1]) >= ._TODAYSDATE and val(a[5]) = 0 then
// Get the type of appointment
atype = find('_MELApptDef', 'ApptType', 'ID', a[3])
// Get the location of care from the first book
b = getfield(a[4],',',' :')
loc = find('_MELBook', 'LocationAbbrevName', 'ID',b[1])
//Get the Book Name
c = getfield(a[4],',',' :')
book = find('_MELBook', 'Name', 'ID',c[1])
// Build the result
result = a[1] + ',' + appttime(a[2]) + ',' + atype + ',' + book
//edit previous line if you want to return only part or use different
delimiters etc
//note this first part is if theres only 1 appointment
endif
else if j > 1 then
while i < j do
i = i+1
a = getRow('_MELCurPatientAppt',i,
'ApptDate','ApptTime','Appttype','Booklist','ApptStatus')
// Find the next appointmnet
if val(a[1]) >= ._TODAYSDATE and val(a[5]) = 0 then
// Get the type of appointment
atype = find('_MELApptDef', 'ApptType', 'ID', a[3])
// Get the location of care from the first book
b = getfield(a[4],',',' :')
loc = find('_MELBook', 'LocationAbbrevName', 'ID',b[1])
//Get the Book Name
c = getfield(a[4],',',' :')
book = find('_MELBook', 'Name', 'ID',c[1])
// Build the result
if result=="" then
result = result + a[1] + ',' + appttime(a[2]) + ',' +
atype + ',' + book else result = result + hret + a[1] + ',' + appttime(a[2])
+ ',' + atype + ',' + book endif
//edit previous line if you want to return only part or use different
delimiters etc
//this part there are 2 or more appointments or rows
endif
endwhile
endif
endif
result
}
Stacey,
I placed your function in my usrlib.txt file and called the function from quick text in a chart update and I get this error:
{SMRMC_APPT_ALL_FUTURE() <-FUNCTION DEFINITION IS NOT EXECUTABLE
any ideas?
We use our in the patient banner but I just tried in quick text in an open update and it worked there too. This is what I pasted into the quick text:
{SMRMC_APPT_ALL_FUTURE()}