ISLetter.UnlinkCDOForm

Description

This function unlinks the CDO Form from the letter of the selected patient.

Syntax

object.UnlinkCDOForm aForm

Part Attribute Type Description
object Required
The object always implements the ISLetter interface
aForm In, Required
The CDO Form linked to the letter

Example

Unlink the CDO Form from the letter of the selected patient.

sub main
  Dim aFilter 
  Dim aPatient
  Dim aCDOForms, aCDOForm
  Dim aTrans
  Dim aLetters, aLetter
  Dim aHRC
  Dim aMessage

  Set aPatient = Profile.SelectPatient

  set aFilter = Profile.CreateCdoFormFilter
  aFilter.PatientId = aPatient.Id
  set aCDOForms = Profile.LoadCdoForms(aFilter)

  set aTrans = Profile.StartMapTransaction  
  set aLetters = aPatient.GetLetters (1) ' slcfWordRTF
  aMessage = "INITIAL STATE:" & GetLinkedCDOFormsInfo(aLetters) 
  
  for each aLetter in aLetters
    for i = 0 to aCDOForms.Count - 1
      set aCDOForm = aCDOForms.Item(i)
      set aHRC = aCDOForm.AsHRC 
      aLetter.UnlinkCDOForm aHRC
    next 
  next
  
  aTrans.Commit  
  
  set aTrans = Profile.StartMapTransaction  
  set aLetters = aPatient.GetLetters (1) ' slcfWordRTF  
  aMessage = aMessage & vbNewLine & vbNewLine &_ 
    "LETTERS AFTER CDO Forms UNLINKING:" & GetLinkedCDOFormsInfo(aLetters) & vbNewLine

  Profile.MsgBox (aMessage)
end sub

function GetLinkedCDOFormsInfo(aLetters)
  Dim aInfo
  Dim aLetter
  Dim aCDOForms, aCDOForm
  
  for each aLetter in aLetters
    aInfo = aInfo & vbNewLine & "Letter Id: " & aLetter.ID
    set aCDOForms = aLetter.LinkedCDOForms
    if aCDOForms.Count > 0 then aInfo = aInfo & vbNewLine & "  CDOForms IDs: "   
    for i = 0 to aCDOForms.Count - 1
      set aCDOForm = aCDOForms.Item(i)
      aInfo = aInfo & aCDOForm.Id & ", "
    next
  next
  GetLinkedCDOFormsInfo = aInfo
end function
Note:

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

See also

Version information

Added in v8.4.59