ISLetter.UnlinkUsualPrescription

Description

This function unlinks the usual prescription from the letter of the selected patient.

Syntax

object.UnlinkUsualPrescription aUsualPrescription

Part Attribute Type Description
object Required
The object always implements the ISLetter interface
aUsualPrescription In, Required
The usual prescription linked to the letter

Example

Unlink the usual prescription from the letter of the selected patient.

sub main
  Dim aPatient
  Dim aLetters, aLetter
  Dim aUsualPrescriptions, aUsualPrescription  
  Dim aMessage
  
  Set aPatient = Profile.SelectPatient
  set aLetters = aPatient.GetLetters (1) ' slcfWordRTF

  aMessage = "INITIAL STATE:" & GetLinkedUsuslaMedicationsInfo(aLetters)
  
  set aUsualPrescriptions = aPatient.Medications.Usual
  for each aLetter in aLetters 
    for each aUsualPrescription in aUsualPrescriptions
      aLetter.UnLinkUsualPrescription aUsualPrescription
    next
  next
  aMessage = aMessage & vbNewLine & vbNewLine &_ 
    "LETTERS AFTER USUAL PRESCRIPTIONS UNLINKING:" & GetLinkedUsuslaMedicationsInfo(aLetters) & vbNewLine
  
  Profile.MsgBox(aMessage)
end sub

function GetLinkedUsuslaMedicationsInfo(aLetters)
  Dim aInfo
  Dim aLetter
  Dim aUsualPrescriptions, aUsualPrescription
  
  for each aLetter in aLetters
    aInfo = aInfo & vbNewLine & "Letter Id: " & aLetter.Id
    set aUsualPrescriptions = aLetter.LinkedUsualPrescriptions
    if aUsualPrescriptions.Count > 0 then aInfo = aInfo & vbNewLine & "  Med IDs: "   
    for each aUsualPrescription in aUsualPrescriptions
      aInfo = aInfo & aUsualPrescription.Oid & ", "
    next
  next
  GetLinkedUsuslaMedicationsInfo = aInfo
end function 
Note:

In Profile Client v8 on User Interface Usual Prescriptions can be found and unlinked in Clinical > Medical Record > Documents > Open saved document > Attachments > Usual Medications or in Organisation > Work Centre > Communication > Letters > Open saved document > Attachments > Usual Medications.

See also

Version information

Added in v8.4.59