ISProfilePatientGroup.Clear

Description

This function removes all patients from the group.

Syntax

object.Clear

Part Attribute Type Description
object Required
The object always implements the ISProfilePatientGroup interface

Example

Clear the patient group and display its patients before and after the clearing.

Sub main
  Dim aGroupName
  Dim aResult
  Dim aFilter
  Dim aPatientGroups
  Dim aPatient
  Dim aIsRemoved
  Dim aMessage

  aGroupName = "test"
  aResult = Profile.InputValue(aGroupName, "Enter Patient Group Name")

  if not aResult then exit sub

  Set aFilter = Profile.CreateProfilePatientGroupFilter
  aFilter.PatientGroupName = aGroupName
  aFilter.PatientGroupType = 1 'spgtStatic  
  set aPatientGroups = Profile.LoadProfilePatientGroupsByFilter(aFilter)

  if aPatientGroups.Count = 0 then
    Profile.MsgBox("There is no group with the specified name")
    exit sub
  end if

  for each aGroup in aPatientGroups 
    aMessage = aMessage & vbNewLine & "The patient group before the clearing :" & vbNewLine &_
      GetGroupMembersInfo(aGroup)
    
    aGroup.Clear
     
    aMessage = aMessage & vbNewLine & "The patient group after the clearing :" & vbNewLine &_
      GetGroupMembersInfo(aGroup)
  next

  Profile.MsgBox(aMessage)
end sub 'main

'---------------

function GetGroupMembersInfo(aGroup)
  Dim aPatientId
  Dim aPatient
  Dim aInfo

  aInfo = "---------------" & vbNewLine & aGroup.Name &_
    vbNewLine & "---------------" & vbNewLine
  for i = 0 to aGroup.PatientCount - 1
    aPatientId = aGroup.PatientId(i)  
    set aPatient = Profile.PatientUtils.LoadPatientByID(aPatientId)
    aInfo = aInfo & vbNewLine & (i + 1) & " ) " & aPatient.SurnameFirstName 
  next      
  GetGroupMembersInfo = aInfo
end function 'GetGroupMembersInfo
Note:

In Profile Client v8 on User Interface Patient Groups can be found in Organisation > Work Centre > Clinical > Groups.

Version information

Added in v7.9.1