scheduler date difference

Hi,

your product is fantastic and ii’m planning to buy as soon as possible, but i’m trying it and i can’t understanda how can i make custom code to update my db with other data depending of my insert or update width the the scheduler.



Specifically, i want to create a custom code that save 1 field that is the difference between the start_date and the end_date.

Who can i make it ?



Thank you so much.

Best regards.

You can use server side events of connector|

function my_code($action){
$diff = some_math($action->get_value(“start_date”),$action->get_value(“end_date”));
$start = $action->add_field(“sql_field_name”,$diff);
}
$sched->event->attach(“beforeProcessing”,“my_code”);
$sched->render_…

With such code, each db operation will have one extra field, with $diff as value.

You can check guide for dhtmlxConnector for more details.
dhtmlx.com/docs/products/dhtmlxC … l#cc_guide


Thank you for your quick response, i’ll try it as soon as possible, but i have another little question:



Is it possible to change the layout html to visualize a field that is equal for an entire day (not in single event) ex. the sum of all the our of any appointment in that day?



Thank you.



Best regards

If I understood your question correctly - you need to show some stat info about events in selected date, right?
Technically it possible - you can run a code which will iterate through all events and calculate lengths of visible ones. ( oncoming update will made it a bit more simple, by providing getEvents method, which returns events for selected date range )