ISRxMedication.DeleteEntityId

Description

This function deletes the entity linked to the Rx medication.

Syntax

object.DeleteEntityId aEntityId

Part Attribute Type Description
object Required
The object always implements the ISRxMedication interface
aEntityId In, Required
The entity identifier

Example

Delete the selected entity linked to the Rx medication and display the number of the rest entities.

sub main
  Dim aMedicationId
  Dim aRxMedication
  Dim aEntities, aEntity
  Dim aRxMedicationInfo

  aMedicationId = 1507 

  Set tr = Profile.StartMapTransaction
  aRxMedicationInfo = GetMedicationEntitiesInfo(aMedicationId, aRxMedication)
  
  if aRxMedication is nothing then 
    Profile.MsgBox(aRxMedicationInfo)  
    exit sub
  end if 
   
  aRxMedicationInfo = "Before deleting: " & aRxMedicationInfo 
     
  set aEntities = aRxMedication.GetEntityIdByIdentifier("Identifier1")  
  if aEntities.Count > 0 then  
    set aEntity = aEntities.Item(0)
    aRxMedicationInfo = aRxMedicationInfo &_
      "Try to delete entity '" & aEntity.Identifier &_
      "' ( with value '" & aEntity.EntityValue & "' )" & vbNewLine
    aRxMedication.DeleteEntityId(aEntity)
  end if         
  tr.Commit
  
  set tr = Profile.StartMapTransaction  
  aRxMedicationInfo = aRxMedicationInfo &_
    "After deleting: " & GetMedicationEntitiesInfo(aMedicationId, aRxMedication)  
  
  Profile.MsgBox(aRxMedicationInfo)
end sub

function GetMedicationEntitiesInfo(aMedicationId, aRxMedication)
  Dim aInfo
  Dim aEntities
  
  Set aRxMedication = Profile.LoadRxMedication(aMedicationId)
  if aRxMedication is nothing then
    aInfo = "There is no Rx Medication with the specified ID" & vbNewLine
  else
    set aEntities = aRxMedication.GetEntityIdByIdentifier("Identifier1")
    aInfo = aRxMedication.RxName & " has " & aEntities.Count &_
      " entities" & vbNewLine
  end if    
  GetMedicationEntitiesInfo = aInfo 
end function 
Note:

In Profile Client v8 on User Interface Entity ID cannot be found and deleted, but Rx medications can be found in Clinical > Medical Record > MedChart.

See also

Version information

Added in v8.2.0