This property returns the existed or newly created form variable with the specified name.
object.Vars(aVarName)
Part | Attribute | Type | Description |
---|---|---|---|
object |
Required | The object always implements the
ISProfileForm interface |
|
aVarName |
In, Required | string |
The name of the form variable |
object
The first macro appends on the form a set of checkboxes that complies with the patient's care team providers. The created checkboxes are stored into the form variables.
The second macro checks the state of all chekboxes stored in the form variables and shows the information about their checked state.
'macro OnIVisualFormMOpen
Set aPatient = Form.Patient
set aCareTeamFilter = Profile.CreateCareTeamFilter
aCareTeamFilter.Patient = aPatient.Id
set aCareTeams = Profile.LoadCareTeams(aCareTeamFilter)
aIndex = 1
for i = 0 to aCareTeams.Count - 1
set aCareTeam = aCareTeams.Item(i)
if aCareTeam.PersonId > 0 then
set aProvider = Profile.LoadProviderById(aCareTeam.PersonId)
set aRoleShortCode = Profile.LoadShortCode(aCareTeam.RoleID)
aCheckBoxName = "chkCareTemProvider" & aIndex
set aProvCheckBox = Form.ControlCreate(1, "TCheckBox", aCheckBoxName)
aProvCheckBox.Left = 2
aProvCheckBox.Top = aIndex * 24 - 22
aProvCheckBox.AutoSize = True
aProvCheckBox.Caption = aProvider.FullName & " (" & aRoleShortCode.Description & ")"
Form.Vars(aCheckBoxName) = aProvCheckBox
aIndex = aIndex + 1
end if
next
Form.Vars("ProvCheckBoxCount") = aIndex - 1
'------------------------------------------------------------------------------------------------
'macro ShowInformationAboutSelectedPatients
Sub Main()
aCount = Form.Vars("ProvCheckBoxCount")
aCheckedCount = 0
for i = 0 to aCount - 1
aCheckBoxName = "chkCareTemProvider" & (i + 1)
set aProvCheckBox = Form.Vars(aCheckBoxName)
if aProvCheckBox.Checked then
aMessage = aMessage & vbNewLine & aProvCheckBox.Caption
aCheckedCount = aCheckedCount + 1
end if
next 'i
if aCheckedCount = 0 then
aMessage = "No care Team Provider is selected"
else
aMessage = aCheckedCount & " care team providers are selected " & aMessage
end if
Profile.MsgBox(aMessage)
End Sub