ISContact.AddTag

Description

This function adds the tag with the specified description to the contact.

Syntax

object.AddTag(aClinicalTagShortCodeID, aContextComment, aContentComment)

Part Attribute Type Description
object Required
The object always implements the ISContact interface
aClinicalTagShortCodeID In, Required
int
ID of short code of type 'Clinical Tag"
aContextComment In, Required
string
The context comment
aContentComment In, Required
string
The content comment

Return Value

int

Returns the added tag.

Example

Add the tag with the specified description to the contact and display the number of the tags before and after adding.

sub main
  Dim aTr
  Dim aPatient   
  Dim aShortCode, aShortCodeID     
  Dim aFilter              
  Dim aEncounter, aEncounters
  Dim i
  Dim aEncounterTags, aEncounterTag
  Dim aMessage
  Dim aContact

  Set aTr = Profile.StartMapTransaction

  set aPatient = Profile.SelectPatient 
  set aFilter = Profile.CreateEncounterFilter
  aFilter.MaxCount = 1
  aFilter.PatientId = aPatient.ID                 
  set aEncounters = aPatient.LoadEncounters(aFilter)
  if aEncounters.Count = 0 then
    Profile.MsgBox("No encounters")
    exit sub
  end if

  set aShortCode = Profile.LoadShortCodeByCodeType("AUDIT", 171) 'sscClinicalTag
  aShortCodeID = aShortCode.ID                                                                                              

  set aEncounter = aEncounters.Item(0)
  set aContact = aEncounter.Contacts.Item(0)   

  aMessage = aMessage & vbNewLine & "Before Adding: " & vbNewLine &_
    GetEncounterTagsInfo(aContact.EncounterTags)
   
  aContact.AddTag aShortCodeID, "abab", "dede"

  aTr.SnapShot

  aMessage = aMessage & vbNewLine & "After Adding: " & vbNewLine &_
    GetEncounterTagsInfo(aContact.EncounterTags)    
                                       
  Profile.MsgBox(aMessage)
end sub

function GetEncounterTagsInfo(aEncounterTags)
Dim aInfo 

  aInfo = "Encounter Tags Count is " & aEncounterTags.Count & vbNewLine

  for i = 0 to aEncounterTags.Count - 1
    set aEncounterTag = aEncounterTags.Item(i) 
    aInfo = aInfo & "Tag Description: " & aEncounterTag.Description & vbNewLine     
  next 
  GetEncounterTagsInfo = aInfo
end function
Note:

In Profile Client v8 on User Interface Encounter Tags can be added in Clinical > Medical Record > Encounters > Open Encounter > Insert a tag into current position.

Version information

Added in v8.3.0
return type changed from void to int in v8.3.0