ISLetter.LinkUsualPrescription

Description

This function links the usual prescription to the letter of the selected patient.

Syntax

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

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

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.LinkUsualPrescription aUsualPrescription
    next
  next
  aMessage = aMessage & vbNewLine & vbNewLine &_ 
    "LETTERS AFTER USUAL PRESCRIPTIONS LINKING:" & 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: This function throws exception when the link between the objects already exists.

In Profile Client v8 on User Interface Usual Prescriptions can be found and linked 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