ISHRI.AddRegistryKey

Description

This function adds a new registry key to the HRI.

Syntax

object.AddRegistryKey(aKeyCode, aKeyValue)

Part Attribute Type Description
object Required
The object always implements the ISHRI interface
aKeyCode In, Required
string
The code of the registry key
aKeyValue In, Required
string
The value of the registry key

Return Value

ISRegistryKey

Returns the added registry key.

Example

Display some information about the CDO forms contents and add a new registry key with the specified code and value to their HRIs.

sub main
  Dim aPatient
  Dim aFilter
  Dim aCDOForms, aCDOForm
  Dim i
  Dim aMessage

  Set aPatient = Profile.SelectPatient
  set aFilter = Profile.CreateCdoFormFilter
  aFilter.PatientId = aPatient.Id
  set aCDOForms = Profile.LoadCdoForms(aFilter) ' ISHRObservations
    aMessage = "CDO Forms (Count = " & aCDOForms.Count & "):"
    
  for i = 0 to aCDOForms.Count - 1  
    set aCDOForm = aCDOForms.Item(i) 'ISHRObservation
    aMessage = aMessage & vbNewLine & (i + 1) & ") " & aCDOForm.Name &_
      GetHRCInfo(aCDOForm.AsHRC, 0)  
  next  
  Profile.MsgBox(aMessage)
end sub

function GetHRIInfo(aHRI, aLevel)
  Dim aSep
  Dim aInfo
  Dim aKeyCode
  Dim aKeyValue
  Dim aRegistryKey
   
  aSep = Space(4 * aLevel)
  aInfo = vbNewLine &_ 
    aSep & " * HRI name: " & aHRI.Name & VbNewLine 
    
  aKeyCode = "RM2" 'this code should be presented in short code category 'Registry (Measure)'
  aKeyValue = "Code3" 
  set aRegistryKey = aHRI.AddRegistryKey(aKeyCode, aKeyValue)
  if not aRegistryKey is nothing then
    aInfo = aInfo & aSep & " - New Registry Key was created " &_
      "(Id= " & aRegistryKey.Id & ", Key Value = '" & aRegistryKey.KeyValue & "')" & vbNewLine
  else 
    aInfo = aInfo & aSep & " - The new Registry Key with the specified code cannot be created" & vbNewLine 
  end if
    
  GetHRIInfo = aInfo    
end function

function GetHRCInfo(aHRC, aLevel)
  Dim aSep
  Dim aInfo
  Dim i
  Dim aObs 
 
  aSep = Space(4 * aLevel)
  aInfo = vbNewLine &_ 
    aSep & " * HRC name: " & aHRC.Name & VbNewLine 
  for i = 0 to aHRC.Count - 1
    set aObs = aHRC.Item(i)
    if aObs.IsHRI then
      aInfo = aInfo & GetHRIInfo(aObs.AsHRI, aLevel + 1)
    else          
      aInfo = aInfo & GetHRCInfo(aObs.AsHRC, aLevel + 1)
    end if 
  next

  GetHRCInfo = aInfo
end function
Note: In Profile Client v8 on User Interface Registry Key cannot be found, but the possible codes of Registry Keys can be found in Maintain > Short Codes > Type 'Registry (Measure)'.

Version information

Added in v8.2.0