afterSave syntax

A place for users and developers of the Xataface to discuss and receive support.

afterSave syntax

Postby fauners » Mon Nov 03, 2008 8:25 am

Hi all,
I have a question regarding the use of afterSave in the delegate class, I;m pretty new to all this so i know i'm going wrong somewhere, just dont know where.
I have two related tabled and a join table, Employees, events and employeeEvents, I can add individuals to certain events and vice versa fine but i am trying to be able to batch update a selection of employees to a certain event so i thought using aftersave would be the best approach.

I have a field in employees that mirrors the event id in employeeEvents, so i'm trying to update several employees by changing this field then change the join table by aftersave. this is the code I tred, with some slight modifications but i couldnt get it working, I just think i have the sytax wrong.
Code: Select all

<class>db());
}
}
?>

Any help would be great? or am I taking a completely stupid way round this and there is an obvious solution staring me in the face?

Thanks n advance,

Adam
fauners
 
Posts: 10
Joined: Fri Oct 31, 2008 6:37 am

Postby fauners » Mon Nov 03, 2008 8:27 am

Sorry here is the code, got cut off there

Code: Select all
<?
class tables_Employees {

function afterSave(&$record){

$app =& Dataface_Application::getInstance();
$res = mysql_query("REPLACE EmployeeEvents (EmployeeID, event_id) SELECT ID, event_id FROM Employees}'", $app->db());
}
}
?>
fauners
 
Posts: 10
Joined: Fri Oct 31, 2008 6:37 am

Postby shannah » Wed Nov 05, 2008 8:27 am

How are you making this "selection" of employees that you want to add to the event?

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby fauners » Wed Nov 05, 2008 9:33 am

Hi steve,

I wanted to select employees in the employee area and then "update set" to a certain event. At the moment i can only add one at a time either through the add existing employees record in the events section or add existing event to an employee in the employee section.

I would like to be able to select a large number of employees and add them to an event, instead of one by one. I have tried other ways but i cant seem to figure out how to get it done.

Any ideas how best to do this?

Thanks,

Adam
fauners
 
Posts: 10
Joined: Fri Oct 31, 2008 6:37 am

Postby shannah » Wed Nov 05, 2008 11:47 am

This sounds like something that you'll want to create a custom action for. There's many ways that you can do this.. I can't go into too much detail right now, but you should be able to find some information in tutorials on how to get started with custom actions.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 28 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved