ISReferral.UnlinkFlowSheet

Description

This function unlinks the flow sheet from the referral of the selected patient.

Syntax

object.UnlinkFlowSheet 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

Unlink the flow sheet from the referral of the selected patient.

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

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

  for each aReferral in aReferrals
    set aFlowSheets = aReferral.LinkedFlowSheets    
    for i = aFlowSheets.Count - 1 to 0 step -1
      aReferral.UnlinkFlowSheet aFlowSheets.Item(i)
    next
  next
  aMessage = aMessage & vbNewLine & vbNewLine &_ 
    "REFERRALS AFTER FLOWSHEETS UNLINKING:" & GetLinkedFlowSheetsInfo(aReferrals) & vbNewLine

  Profile.MsgBox(aMessage)
end sub

function GetLinkedFlowSheetsInfo(aReferrals)
  Dim aInfo
  Dim aFlowSheets, aFlowSheet
  Dim aReferral

  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:

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

Version information

Added in v8.4.32