ISCase.DeleteRegistryKey

Description

This function deletes the selected registry key of the case.

Syntax

object.DeleteRegistryKey aRegistryKey

Part Attribute Type Description
object Required
The object always implements the ISCase interface
aRegistryKey In, Required
The registry key to delete

Example

Display the registry keys of the case before and after deleting one of them.

sub main()

  Dim aTrans
  Dim aFilter
  Dim aPatient 
  Dim aCaseTypes, aCaseType
  Dim aNewCase
  Dim aNewRegKey
  Dim aMessage

  Set aTrans = Profile.StartMapTransaction  
  set aFilter = Profile.CreateCaseTypesFilter
  aFilter.Description = "Case Type 1" 
  set aCaseTypes = Profile.LoadCaseTypes(aFilter)

  if aCaseTypes.Count = 0 then 
    Profile.MsgBox("No case type with the specified description")
    exit sub
  end if
  
  set aCaseType = aCaseTypes.Item(0)

  set aPatient = Profile.SelectPatient
  set aNewCase = Profile.CreateCase(aPatient.ID)
  aNewCase.CaseTitle = "New Case147"
  aNewCase.CaseType = aCaseType
  set aNewRegKey = aNewCase.AddRegistryKey("REG1", "NewRegKey_1")

  if aNewRegKey is nothing then 
    Profile.MsgBox("No registry key with the specified code")
    exit sub
  end if

  aTrans.SnapShot 

  aMessage = aNewCase.CaseTitle & " was opened on " & aNewCase.OpenedOn &_ 
    vbNewLine & vbNewLine & "THE STATE AFTER ADDING REG KEY:" & vbNewLine &_
    GetCaseRegistryKeyInfo(aNewCase.ID)
    
  aNewCase.DeleteRegistryKey(aNewRegKey)
  aTrans.SnapShot

  aMessage = aMessage & vbNewLine & "THE STATE AFTER DELETING REG KEY:" & vbNewLine &_
    GetCaseRegistryKeyInfo(aNewCase.ID)     

  Profile.MsgBox(aMessage)

end sub

function GetCaseRegistryKeyInfo(aCaseID)

  Dim aCase
  Dim aRegistryKeys
  Dim aRegistryKey
  Dim aMessage
  
  set aCase = Profile.OpenCase(aCaseID)
  set aRegistryKeys = aCase.GetRegistryKeys
  aMessage = aMessage & vbNewLine & "Registry Keys Сount = " & aRegistryKeys.Count & vbNewLine 

  for i = 0 to aRegistryKeys.Count - 1
    set aRegistryKey = aRegistryKeys.Item(i)
    aMessage = aMessage & "'" & aRegistryKey.KeyCode.Description & "' = '" &_ 
      aRegistryKey.KeyValue & "'" & vbNewLine 
  next
  GetCaseRegistryKeyInfo = aMessage
end function  
Note:

In Profile Client v8 on User Interface Registry Key can be found and deleted in Organisation > Work Centre > Work > Cases > Edit Case > Administrative > Registry.

See also

Version information

Added in v8.4.0