Howdy Chuggers!
I am trying to create a checklist for the doctor to chose from so that he can reference a future appointment. The idea is that a statement such as:
"We will discuss these results during our next scheduled appointment: {checklist selection goes here}"
I would like to have a dynamic checklist that looks at future scheduled appointments for the MD to select from. Has anyone created something like this already?
I'm thinking that I could run a MEL function such as: APPTS_BY_STATUS("Scheduled","FULL"), add it to an array that is comma delimited to create the checklist. Am I thinking in the right direction? I'm a little lost on how I would apply that last step...
See the following thread that I created:
APPTS_BY_STATUS, list into an array
https://centricityusers.com/?page_id=.....8;search=1
I will go ahead and give you the basic steps though:
1) local appts_list = getfield(APPTS_BY_STATUS("scheduled"),HRET,"\r")
You may not need to use the "FULL" specifier if you don't need all the info that it returns. See the help topic on this. In fact, it will be much more difficult to get the FULL list to do what you want, since the list for a dropdown is separated by commas. The FULL return value for APPTS_BY STATUS() is loaded with commas and you'd have to get them out before applying to a dropdown.
This code above will put your appts list into an array. As explained in the referenced thread, there is an issue when using getfield() on a function that returns a 'list' in Centricity. Only odd array elements get populated, and I can't quite figure out why. But, it can be worked around as I will soon describe.
2) declare a local called return_string:
local return_string = ""
We declare it this way b/c we are going to use a FOR loop to build the string up.
3) Loop through the array and build your comma-separated list. Notice I'm using i=i+2 here, because every other array element is blank. You could do i=i+1 and add a condition right after DO that says if(appts_list[i]<>"")then ...it's up to you.
FOR i=1,i<=size(appts_list),i=i+2
DO
return_string = return_string + "," + appts_list[i]
ENDFOR
4) Return the string you just created, and call your function in the drop down.
In your function definition:
return return_string
In the 'MEL Expression' area:
{
your_function_here()
}
Hope this helps,
--jrea
Thanks so much, jrea!