ISReferral.LinkFlowSheet

Description

This function links the flow sheet to the referral of the selected patient.

Syntax

object.LinkFlowSheet aFlowSheet

Part Attribute Type Description
object Required
The object always implements the ISReferral interface
aFlowSheet In, Required
The flow sheet linked to the referral

Example

Link the flow sheet to the referral of the selected patient and display its code.

sub main
  Dim aPatient
  Dim aFilter
  Dim aReferrals, aReferral
  Dim aFlowSheets, aFlowSheet
  Dim aMessage
  
  Set aPatient = Profile.SelectPatient
  set aFilter = Profile.CreateReferralsFilter
  aFilter.Patient = aPatient
  set aReferrals = Profile.LoadReferrals(aFilter)

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

  set aFilter = Profile.CreateFlowSheetFilter
  aFilter.PatientId = aPatient.Id
  set aFlowSheets = Profile.LoadFlowSheets(aFilter)
  for each aReferral in aReferrals 
    for each aFlowSheet in aFlowSheets
      aReferral.LinkFlowSheet aFlowSheet
    next
  next
  aMessage = aMessage & vbNewLine & vbNewLine &_ 
    "REFERRALS AFTER FLOWSHEETS LINKING:" & GetLinkedFlowSheetsInfo(aReferrals) & vbNewLine

  Profile.MsgBox(aMessage)
end sub

function GetLinkedFlowSheetsInfo(aReferrals)
  Dim aReferral
  Dim aInfo
  Dim aFlowSheets, aFlowSheet
  
  for each aReferral in aReferrals
    aInfo = aInfo & vbNewLine & "Referral Id: " & aReferral.Id
    set aFlowSheets = aReferral.LinkedFlowSheets
    if aFlowSheets.Count > 0 then aInfo = aInfo & vbNewLine & "  FlowSheets Codes: "   
    for each aFlowSheet in aFlowSheets
      aInfo = aInfo & aFlowSheet.Code & ", "
    next
  next
  GetLinkedFlowSheetsInfo = aInfo
end function  
Note: This function throws exception when the link between the objects already exists.

In Profile Client v8 on User Interface Flow Sheets can be found and linked in Patient > Patient Referrals > Open selected Referral > Attachments > Flow Sheets > Move to Attached items.

Version information

Added in v8.4.32