Can I call function defined in "function library" from handout and letters. I have couple of function that are used in VFE forms and want to reuse them in handouts and letters.
I have not seen any letters that do this. instead, most letters declare the function at the top of the letter, and then use the function in the letter below. here is a pseudocode example:
{fn InsertFullTitle(){
local name = ""
Provider.getname
//code to mess with providers name and title
if Patient.PCP == User.Full Name
...
...
else name = user.regularName
return name
}}
Dear Patient,
here is a letter for you with lab results. blah blah blah
sincerely, {InsertFullTitle}
Please let me know if you have any questions about this. If someone else has had a different experience, I would love to know as well.
Thank you,
Dan
It is not possible to call the traditional function library (text component) from a letter or handout unless an update is open and containing said function (I believe this is still possible - might want to verify - haven't checked in a while).
You can, however, create a user library, which is loaded on start up of the EMR, remains in memory until shutdown, and is available for use anywhere within the EMR. This should be used carefully because it is remotely possible cross patient data between charts. Beyond that concern, which can be mitigated, the only downside is that since the user library contents remain in memory, it can start to affect performance if it is over utilized or not carefully coded (think recursive executions).
To utilize a user library (which you can actually create from the function library you already created), review the VFE Help File.
One note of caution: Always remember that functions that share the same name will be overwritten by the 'newest insertion'. For example: You utilize a user library for a function and then insert a form with a function library containing a function with the same name. The function library version will overwrite the user library version and remain that way until the EMR is closed and restarted. Always ensure unique naming conventions are used to avoid this potential pitfall.
Hope this helps.
@dcarpenter thank for taking time to reply. I did not want to copy the function in multiple place. In the future if i have to make any changes it will be hard to keep track of all the places those functions are copied. I have had similar issues in the past and now I am using user library which makes things much easier. Is there a good way to keep track of functions that I use?
@Lee Thank you. I am looking at VFE help but the only thing I see is function libraries. I could not find anything under user library
In VFE Help:
Reference>Function Libraries>Implementing User Libraries
That is the section you are looking for. 🙂
This is awesome. Thank you Lee