ISPatientRule.Delete

Description

This function deletes the patient rule from the collection.

Syntax

object.Delete

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

Example

Delete the patient rule from the collection and display the number of the patient rules loaded by the specified patient ID before and after deleting one of them.

sub main
  Dim aTrans
  Dim aPatient
  Dim aPatientId
  Dim aRules
  Dim aRule
  Dim aMessage

  set aTrans = Profile.StartMapTransaction
  Set aPatient = Profile.SelectPatient 
  aPatientId = aPatient.Id
  
  set aRules = Profile.LoadPatientRules(aPatientId)
  aMessage = "Before deleting: " & vbNewLine & GetpatientRulesAsText(aRules)

  if aRules.Count > 0 then
    set aRule = aRules.Item(0) 
    aMessage = aMessage & vbNewLine & "Try to delete item" & aRule.Description &_
      vbNewLine 
    aRule.Delete
  end if  

  aTrans.Commit
  
  set aTrans = Profile.StartMapTransaction  
  set aRules = Profile.LoadPatientRules(aPatientId)
  
  aMessage = aMessage & vbNewLine & "After deleting: " & vbNewLine &_
    GetpatientRulesAsText(aRules)
  
  Profile.MsgBox(aMessage)  

end sub

function GetpatientRulesAsText(aRules)
  Dim aText
  Dim aProvider
  Dim aRule
  Dim i
  
  aText = "The number of the patint rules is " & aRules.Count & vbNewLine
  for i = 0 to aRules.Count - 1
    set aRule = aRules.Item(i)
    set aProvider = Profile.LoadProviderById(aRule.CreatedBy)
    aText = aText & "The patient rule '" & aRule.Description &_
      "' was created on " & aRule.CreatedOn & " by " & aProvider.FullName & vbNewLine  
  next  
    
  GetpatientRulesAsText = aText
end function            
Note:

In Profile Client v8 on User Interface Deleted Patient Rules cannot be found, Patient Rules can be found in Patient > Alter Patient > Bookings > Patient Rules.

Version information

Added in v8.1.0