How to insert php session variable along with event?

My scheduler currently filters for events sharing an appointment_id, which is stored as a session variable. I am using one calendar to display several potential appointment dates, so each set of events should have the same appointment_id to keep them together while scheduling. How can I insert that id along with the rest of the event info? I’ve been unable to find something that worked for me … Any help would be greatly appreciated!

I tried with add_field and set_value and also rendering table with sql, but cant seem to get it to work. In fact using render_sql it doesn’t save anything to the db… heres the few relevant lines:

##render
$conn->render_sql(“select * from docflight_appointments_scheduling where appointment_number = ‘$apt_num’”,“id”,“start_date,end_date,text”)

##handler
function do_processing($action){
$conn>add_field(“appointment_number”, $apt_num);
}

$conn->event->attach(“beforeProcessing”,do_processing);

$conn->render_table(“docflight_appointments_scheduling”,“id”,“start_date,end_date,text”,“appointment_number”);

Please be sure that

  • you have only one render command ( render_table or render_sql ), or you are using is_select_mode to route execution flow to the necessary command ( you can have different instructions for data loading and for data saving )

  • $conn->event->attach is placed before render_ command ( as code after render_ command is never executed )

Also, code of do_processing need to be changed

function do_processing($action){ //add_field is method of action, not connector $action->add_field("appointment_number", $apt_num); }