We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to get previous appointment data

Thread ID:

Created:

Updated:

Platform:

Replies:

128925 Feb 16,2017 06:15 AM Feb 17,2017 08:04 AM ASP.NET MVC 1
loading
Tags: Schedule
CLAUDIO RICCARDI
Asked On February 16, 2017 06:15 AM

Suppose I create a new appointment on the schedule.

I want to set the value of a custom field depending on the value of another custom field in the previous appointment. How can I do that?

Example.

Appointment 1 (location 1): duration 1hour + the time I need to reach location 1
Appointment 2 (location 2): duration 1 hour + the time I need to reach location 2 from location 1


In order to calculate the time I need to reach location 2, I have to read the location of the previous appointment (location 1)

Thanks

Karthigeyan Krishnamurthi [Syncfusion]
Replied On February 17, 2017 08:04 AM

Hi Claudio,  
 
Thank you for contacting Syncfusion support. 
 
We have prepared the sample to access the previous appointment field values while creating an appointment, which can be download from the below location. 
 
In the sample when an appointment is saved, BeforeAppointmentCreate event will be raised where your requirement can be achieved. Kindly refer the below code example used in the sample. 
 
<Code> 
function onBeforeAppointmentCreate(args) { 
        var predicate = ej.Predicate(this._appointmentSettings["startTime"], ej.FilterOperators.lessThanOrEqual, new Date(args.appointment.StartTime)); 
        var newAppList = new ej.DataManager(this._currentAppointmentData).executeLocal(new ej.Query().where(predicate)); // app collection before the new added app will be retrived 
        var proxy = this; 
        newAppList.sort(function (a, b) { // sorting the app collection based on start time 
            var d1 = a[proxy._appointmentSettings["startTime"]]; 
            var d2 = b[proxy._appointmentSettings["startTime"]]; 
            return d1.getTime() - d2.getTime(); 
        }); 
        if (newAppList.length>0) 
        args.appointment["Location"] = 4 + newAppList[newAppList.length - 1].Location; // last app in the collection value is accessed here. 
    } 
</Code> 
 
Regards, 
Karthigeyan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;