ISLetter.TranslateVariables

Description

This function replaces the letter variables from the template with the actual ones for the current context.

Syntax

object.TranslateVariables aContext

Part Attribute Type Description
object Required
The object always implements the ISLetter interface
aContext In, Required
The context for translating letter variables

Example

Replace the letter variables from the template with the actual ones for the current context.

Dim aPatient
Dim aLetters, aLetter
Dim aPatientID
Dim aLetterTemplateId
Dim aNewLetter
Dim i
Dim aMessage

Set aPatient = Profile.SelectPatient
set aLetters = aPatient.GetLetters (9) 'slcfHTML
aPatientID = aPatient.ID

aMessage =_
  "The number of the letters of the selected format is " & aLetters.Count

for i = 0 to aLetters.Count - 1
  set aLetter = aLetters.Item(i)
  aLetterTemplateId = aLetter.Template.ID
  set aNewLetter = Profile.CreateLetter (aPatientID, aLetterTemplateId)
  
  set aContext = Profile.MakeDocumentVariableContext
  aNewLetter.TranslateVariables aContext
  aNewLetter.Subject2 = "Translated: " & aNewLetter.Subject2
  aNewLetter.Save
   
  aMessage = aMessage & vbNewLine & " The letter was successfully created: " &_
    aNewLetter.Subject2     
next

Profile.MsgBox (aMessage)    
Note:

In Profile Client v8 on User Interface Letters can be found in Clinical > Medical Record > Documents or in Organisation > Work Centre > Communication > Letters.

See also

Version information

Added in v7.8.0