I am adding a Data field onto a VFE form that needs to be populated by the patient's next appointment, but ONLY if the location of that appointment matches the current users location. I have looked at a few forum posts and it looks like I might be able to use _MELCurPatientAppt from mellib.txt.
However, the small function I have written to run on form load does not pull any data from the global variable. Could this be because of the EMR version I am on? 9.8.11
Here is the small amount of code. The patient I am using to test has one appointment on 5/20/2016.
local rowCount = getRowCount('_MELCurPatientAppt')
local i=1
while i<=rowCount do
userok(i)
i=i+1
endwhile
Try this one _PatientAppointments, It is working in CPS,
The one you reference above is initialized in the mellib.txt file in the client directory. You can check there to see what else may be available. In my EMR 9.8 Evaluation directory it looks like that object should be available.
getrow() and getrowcount() are what you want to use. I just noticed you are trying to use userok() with a value though, you will need to convert that to a string for the popup, this is what I did to check it.
{userok(str(getrowcount('_PatientAppointments')))}