ISAppointment.Save2

Description

This function saves the appointment.

Syntax

object.Save2(aCheckDuplicates, aErrorMsg)

Part Attribute Type Description
object Required
The object always implements the ISAppointment interface
aCheckDuplicates In, Required
bool
Checks duplicated appointments
aErrorMsg Out, Required
object&
Returns a list of errors if the appointment was not saved, otherwise, returns an empty string

Return Value

bool

Returns True if the appointment was saved successfully.

Example

Display "True" if the appointment was saved successfully.

Dim aPatient
Dim aProvider
Dim aFilter 
Dim aAppointments
Dim aFirstAppointment
Dim aNewAppointment
Dim aCheckDuplicates
Dim aResult
Dim aErrorMsg


set aPatient = Profile.SelectPatient
set aProvider = Profile.LoadProvider("PROV")
set aFilter = Profile.CreateAppointmentFilter

aFilter.ProviderID = aProvider.Id
aFilter.PatientId = aPatient.Id
aFilter.DateFrom = #01/01/2018#
aFilter.DateTo = #01/01/2019#

set aAppointments = Profile.LoadAppointments(aFilter)

if aAppointments.Count > 0 then
  set aFirstAppointment = aAppointments.Item(0)
  set aNewAppointment = Profile.CreateAppointment
  aNewAppointment.ProviderId = aFirstAppointment.ProviderId
  aNewAppointment.BookTime = aFirstAppointment.BookTime
  aNewAppointment.Duration = aFirstAppointment.Duration
  aNewAppointment.PatientId = aFirstAppointment.PatientId
  aCheckDuplicates = true
  aResult = aNewAppointment.Save2(aCheckDuplicates, aErrorMsg)
  if aResult then 
    Profile.MsgBox("The appointment was saved successfully")
  else
    Profile.MsgBox("The appointment was not saved successfully. " & aErrorMsg)
  end if
else
  Profile.MsgBox("aAppointments.Count = 0")
end if 
Note:

In Profile Client v8 on User Interface Save2 cannot be found.

Version information

Added in v7.8.0