Note: UBC has moved to CERNER on October 27, 2023 as their clinical chart. However, UBC staff may still utilize some forms in Profile EMR and therefore may have some edit requests.
Identify Requests that should use this Functionality
Manage/View current UBC Doctors Included
Implement the Functionality
Identify Requests that should use this Functionality
There are reoccurring requests from UBC to either add or update existing forms with these features:
- Contain a dropdown that lists all the current UBC Neurologists' names
- Populate a text field with their College ID or MSP
The code in this article can be used to dynamically populate the dropdown with the names of UBC Neurologists and to have a text field populate with the College ID or MSP based on the the dropdown selection.
All other cases of requests can ignore this article.
Manage/View current UBC Doctors Included
- Sign into EMR production using a Sys Admin account
- Go to Maintain > Short Codes to open the Short Codes window
- Select UBC Doctors type on the left pane
- After selection, the right pane will display all the current UBC neurologists that will populate in the forms (listed by clinician user code)
- If need to, from here you can add a new neurologist or delete one who has left.
Note: for now we only support functionality for neurologists.
Implement the Functionality
1. In form editor, add a combo box with these properties (the rest can remain the default values):
| Name | cbRefPhyName |
| ComboBoxKind | cbkdCustom |
| HideBordersWhenPrint | True |
| Style | csOwnderDrawVariable |
2. Add a text field with these properties (the rest can remain the default values):
| Name |
If displaying MSP: edRefPhyMSP If displaying College ID: edRefPhyCollegeID |
| EditKind | edkdCustom |
| HideBordersWhenPrint | True |
| ReadOnly | True |
3. Edit macro AccelEMR_FormAutoLoad
a. Add this code to the Main sub before the check to see if it's the first time the form is loading or a subsequent load of the form (grey italic text for reference for where to place the code)
- If populating the College ID:
' set Referring Physician combobox
Set cbPhysicianList = Form.Controls_("cbRefPhyName")
cbPhysicianList.Items.Clear
Set colShortCodes = Profile.LoadShortCodesByDescription("UBC Doctors", "Neurologist")
For i = 0 to colShortCodes.Count - 1
Set objProvider = Profile.LoadProvider(colShortCodes(i).Code)
If objProvider.ID > 0 Then
cbPhysicianList.Items.AddData objProvider.FullName , GetCollegeID(objProvider)
End If
Next
cbPhysicianList.Sorted = True
'Check if any data has been previously saved, if not, this is the first
'time the form has been opened.
If serial = "" Or instr(serial, "=") < 4 Then
Call OnFirstOpen
Call OnEveryOpen
- If populating the MSP:
' set Referring Physician combobox
Set cbPhysicianList = Form.Controls_("cbRefPhyName")
cbPhysicianList.Items.Clear
Set colShortCodes = Profile.LoadShortCodesByDescription("UBC Doctors", "Neurologist")
For i = 0 to colShortCodes.Count - 1
Set objProvider = Profile.LoadProvider(colShortCodes(i).Code)
If objProvider.ID > 0 Then
cbPhysicianList.Items.AddData objProvider.FullName , GetMSPID(objProvider)
End If
Next
cbPhysicianList.Sorted = True
'Check if any data has been previously saved, if not, this is the first
'time the form has been opened.
If serial = "" Or instr(serial, "=") < 4 Then
Call OnFirstOpen
Call OnEveryOpen
b. Add these two functions at the very bottom of the macro:
Function GetCollegeID(objProvider)
GetCollegeID = ""
If objProvider Is Nothing Then Exit Function
If objProvider.ReferenceSystem Is Nothing Then Exit Function
If objProvider.ReferenceSystem.Code <> "CMC" Then Exit Function
GetCollegeID = objProvider.ReferenceCode
End Function
Function GetMSPID(objProvider)
GetMSPID = ""
If objProvider Is Nothing Then Exit Function
Set objAlias = objProvider.LoadAlias("MSP")
If objAlias Is Nothing Then Exit Function
GetMSPID = objAlias.Reference1
End Function
4. Create macro OnPhysicianListChange with the code below:
a. If populating the MSP, replace any premade text in the new macro with this code:
'macro OnPhysicianListChange
'Purpose: When dropdown of physicians is changed, update corresponding College ID and the other sets in the form
Sub Main()
Set aCbPhysList = Profile.Variable("Sender").Value
aInxPhys = aCbPhysList.ItemIndex
aPhyMSP = ""
If aInxPhys >=0 Then
aPhyMSP = aCbPhysList.SelectedData
End If
Form.Controls_("edRefPhyMSP").Text = aPhyMSP
End Sub
b. If populating the College ID, replace any premade text in the new macro with this code:
'macro OnPhysicianListChange
'Purpose: When dropdown of physicians is changed, update corresponding College ID and the other sets in the form
Sub Main()
Set aCbPhysList = Profile.Variable("Sender").Value
aInxPhys = aCbPhysList.ItemIndex
aPhyCollegeID = ""
If aInxPhys >=0 Then
aPhyCollegeID = aCbPhysList.SelectedData
End If
Form.Controls_("edRefPhyCollegeID").Text = aPhyCollegeID
End Sub
5. Update dropdown cbRefPhyName's event OnMChange to use OnPhysicianListChange
6. Save form edits and validate changes by creating a new form, confirming the names are in the dropdown, and that the text field changes when different names are selected from the dropdown.