ISReferral.LinkResult

Description

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

Syntax

object.LinkResult aCDOTransaction

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

Example

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

sub main
  Dim aPatient
  Dim aFilter
  Dim aReferrals, aReferral
  Dim aResults, aResult
  Dim aMessage

  Set aPatient = Profile.SelectPatient
  set aFilter = Profile.CreateReferralsFilter
  aFilter.Patient = aPatient
  set aReferrals = Profile.LoadReferrals(aFilter)

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

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

  Profile.MsgBox(aMessage)
end sub

function GetLinkedResultsInfo(aReferrals)
  Dim aReferral
  Dim aInfo
  Dim aResults, aResult
  
  for each aReferral in aReferrals
    aInfo = aInfo & vbNewLine & "Referral Id: " & aReferral.Id
    set aResults = aReferral.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 Patient > Patient Referrals > Open selected Referral > Attachments > Pathology > Radiology > Move to Attached items.

See also

Version information

Added in v8.4.32