ISHRC.AsHRC

Description

This function is inherited from the ISHRObservation interface and always returns the object itself.

Syntax

object.AsHRC()

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

Return Value

ISHRC

Always returns the object itself.

Example

Display some information about the CDO forms contents, including the names of their HRCs and 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 GetName(aHRIorHRC)
  Dim aHRI
  Dim aHRC

  set aHRI = aHRIorHRC.AsHRI
  set aHRC = aHRIorHRC.AsHRC   
 
  if not aHRI is nothing then 
    GetName = aHRI.Name
  elseif not aHRC is nothing then 
    GetName = aHRC.Name
  else    
    GetName = ""
  end if
end function

function GetHRIInfo(aHRI, aLevel)
  Dim aSep
  Dim aInfo  
   
  aSep = Space(4 * aLevel)
  aInfo = vbNewLine & aSep & " * HRI name: " & GetName(aHRI) & VbNewLine    
  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: " & GetName(aHRC) & 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 HRCs can be found in Clinical > Medical Record > Results or in Clinical > Review Results.

Version information

Added in v7.8.0