I am wanting to fill in a drop down box, in VFE, with a list of providers that match the current users location. So if the current users location is "Pediatric Surgery" I want to pull all providers that have a home location of "Pediatric Surgery".
Thanks in advance!
Getting the user's current location of care is not so bad. You can store that in a variable using something like:
local userloc = USER.CURLOCATIONNAME
I am unaware of a MEL function that will return a list of providers at a particular location. You would need to use a third party tool to query the database and then pass the results as a comma delimited list to dynamically populate the list. Another option would be to store a hardcoded list of providers for each location in separate files that would be accessible with a function that gets fired when you load the form. For example, if you had a file named PediatricSurgery_Providers.txt that contained a comma delimited list of those providers, you could have a function similar to:
local myfile = ""
local fhand = "" //needed to open and read a text file
local var_list_values //variable used to store comma delimited list of provider names
//Identify file that contains list of providers based on user location
cond
case userloc = "Pediatric Surgery"
myfile = "M:\PediatricSurgery_Providers.txt"
case userloc = "South Clinic"
myfile = "M:\SouthClinic_Providers"
case ........etc
endcond
fhnd = FILEOPEN(myfile, "r") //this opens the file in read only mode
if fhnd <> NULL then
var_list_values = FILEREAD(fhnd)
FILECLOSE(fhnd) //close file
else
userok("Error: " + myfile + " file could not be found."
endif
The file named PediatricSurgery_Providers.txt would contain a single line of comma delimited providers (see example below). The M:\ drive might be a networked drive where these files were maintained (CPS client would obviously need access to that drive mapping) or you could push files out to local clients using jobs.txt file:
Dr. Jones,Dr. Walker, Dr. Ironside, Dr. House
You would need to use the variable name {var_list_values} as a "dynamic choice list" for the dropdown list control.
Hope this makes sense. Not as dynamic as querying the database with a third party tool and returning the current values, but it wouldn't be too bad to maintain a few files.
I am trying to test this solution and I can not get it to run. I placed a userok in the middle so I can see that it is actually running. Whenever the form loads and I click on the dropdown it is empty, and the function is never called.
Edit: My terrible grammer
Try inserting a push button on your form that calls the function when you click the button. This will at least verify that your function will work correctly. Once you have that working properly, you can then turn your attention to having the function fire when the form first loads. There are a couple of options for making that happen. If you send me the .dlg file, I can probably get it working for you and then report back with the solution. Once this is working, you could run a stored procedure in SQL Server to update the text file that contains the comma delimited list of providers for each of your locations.
In your watcher expression, try setting the variable that your dropdown list references as follows:
{
!var_LocationDDL = ProviderList() //the function should return the comma delimited text string
}
If you are using a function similar to the one I provided above, the last line in your function would be:
return var_list_values
Here is the dlg and the txt file I was using. Not sure what I am doing wrong here. I have tried your suggestion and that function will not run. The form object I am trying to populate id Designated Provider on the first tab.
I got it working.For whatever reason the function will not run if a string is being formatted. If I tried to add two strings together "String 1" + "String 2", or if I tried to use CFMT, the function would not run. Now I just need to get it to run when the form loads. I have tried {fn form_load} but that did not work. I am new to the VFE and do not know the syntax yet.
I've attached a working model of what you desire. I tried adding this functionality to your form but was having issues with the .dlg file you provided. I have attached a screenshot as well as the .dlg file that demonstrates how to dynamically populate a dropdown list. The userok calls in the code can be removed; they are there for troubleshooting purposes only.
Screenshot
DLG file
Thank you! This is great.
I do have one last question. My team does not want to host those physician list files on the local computers. We also can not host them on a mapped drive because we have several hundred computers that do not have a mapped drive in common. Is it possible to store the physician list file on the EMR server, and access it from the VFE form?
If you are running in a thin client environment (Citrix or RDS/RDP), then you only have to maintain the files on your terminal server or Citrix hosts. If you are running fat client installations, your options are more limited. If you have a fat client environment, you could set up a group policy to map a specific network drive to a specific letter of the alphabet and store the files there. Sounds like that may not be an option from your previous post. The other option is to use a file copying utility called "jobs.txt" that Centricity provides to copy the relevant files (latest versions) to the local computer when a user launches Centricity. There are other ways to deploy these files to the local computer as well, but would require a login script or group policy to be setup and associated with your network users. See link to article below for more info: