ISPatientProblem.AddRegistryKey

Description

This function adds a new registry key to the patient's problem.

Syntax

object.AddRegistryKey(aKeyCode, aKeyValue)

Part Attribute Type Description
object Required
The object always implements the ISPatientProblem interface
aKeyCode In, Required
string
The code of the registry key. The possible key codes can be found in Maintain/Short Codes/Type 'Registry (Problem)'
aKeyValue In, Required
string
The value of the registry key

Return Value

ISRegistryKey

Returns the added registry key.

Example

Add a new registry key with the specified code and value to the patient's problem and display all registry keys of this problem.

Dim aTrans
Dim aPatient  
Dim aProblemList, aProblem
Dim aNewRegKey
Dim aProblem2
Dim aRegistryKeys, aRegistryKey
Dim aMessage

'The first mapping transaction
Set aTrans = Profile.StartMapTransaction

set aPatient = Profile.SelectPatient 
set aProblemList = aPatient.ProblemList

if aProblemList.Count = 0 then
  Profile.MsgBox("The patient has no problems")
  exit sub
end if

set aProblem = aProblemList.Item(0)
set aNewRegKey = aProblem.AddRegistryKey("REGPROBLEM1", "NewRegKey_1")

if aNewRegKey is nothing then 
  Profile.MsgBox("No registry key with the specified code")
  exit sub
end if
 
aNewRegKey.SourceRef = "1234567890ABC"
aProblem.Save
aTrans.SnapShot

'The second mapping transaction
set aTrans = Profile.StartMapTransaction
set aProblem2 = Profile.LoadPatientProblemByGUID(aProblem.GUID) 
set aRegistryKeys = aProblem2.GetRegistryKeys
aMessage = "Registry Keys count for the first problem = " &_ 
  aRegistryKeys.Count & vbNewLine 

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

Profile.MsgBox(aMessage)  
Note:

In Profile Client v8 on User Interface Registry Key cannot be found.

Version information

Added in v8.2.0