ISLetter.LinkResult

Description

This function links the result to the letter of the selected patient.

Syntax

object.LinkResult aCDOTransaction

Part Attribute Type Description
object Required
The object always implements the ISLetter interface
aCDOTransaction In, Required
The result linked to the letter

Example

Link the result to the letter of the selected patient and display its ID.

sub main
  Dim aPatient
  Dim aFilter
  Dim aLetters, aLetter
  Dim aResults, aResult
  Dim aMessage

  Set aPatient = Profile.SelectPatient
  set aLetters = aPatient.GetLetters (1) ' slcfWordRTF

  aMessage = "INITIAL STATE:" & GetLinkedResultsInfo(aLetters)

  set aFilter = Profile.CreateCDOTransFilter
  aFilter.PatientId = aPatient.Id
  aFilter.TransactionTypes = 24 ' tsotwePathologyResults + tsotweRadiologyResults 
  set aResults = Profile.LoadCDOTransactions(aFilter)  
  for each aLetter in aLetters 
    for each aResult in aResults
      if aResult.FilingCategory = 3 or aResult.FilingCategory = 4 then 'scfcPathology or scfcRadiology 
        aLetter.LinkResult aResult
      end if  
    next
  next
  aMessage = aMessage & vbNewLine & vbNewLine &_ 
    "LETTERS AFTER RESULTS LINKING:" & GetLinkedResultsInfo(aLetters) & vbNewLine

  Profile.MsgBox(aMessage)
end sub

function GetLinkedResultsInfo(aLetters)
  Dim aLetter
  Dim aInfo
  Dim aResults, aResult
  
  for each aLetter in aLetters
    aInfo = aInfo & vbNewLine & "Letter ID: " & aLetter.ID
    set aResults = aLetter.LinkedResults
    if aResults.Count > 0 then aInfo = aInfo & vbNewLine & "  Results IDs: "   
    for each aResult in aResults
      aInfo = aInfo & aResult.Id & ", "
    next
  next
  GetLinkedResultsInfo = aInfo
end function  
Note: This function throws exception when the link between the objects already exists.

In Profile Client v8 on User Interface Results can be found and linked in Clinical > Medical Record > Documents > Open saved document > Attachments > ticked items in Pathology/Radiology nodes or in Organisation > Work Centre > Communication > Letters > Open saved document > Attachments > ticked items in Pathology/Radiology nodes.

See also

Version information

Added in v8.4.59