afterImport-trigger?
Posted: Thu Nov 27, 2008 10:42 am
Hi Steve, hi all,
is it possible to have an afterImport-trigger?
I try to do the following. After having imported a couple of records I would like to do an update on all the imported records.
The update should run automatically and insert a combination of the recently inserted auto_increment (v_id, my primary key) and another populated field of the table.
If I try it with an afterInsert function it gives me an error because the auto_incremet is not actually there I suppose.
gives back: Fatal error: Call to a member function val() on a non-object in C:\xampp\htdocs\webseiten\biogasdb.lokal\tables\versuch\versuch.php on line 47 where line 47 is: $vid = $record->val('v_id');
which means that the auto_increment v_id is not in place.
When I try an afterSave trigger it will work on every single record after saving. This would probably be a possibility but you have to save every single of the imported records manually (could be many).
Any Idea?
Thank you
Markus
is it possible to have an afterImport-trigger?
I try to do the following. After having imported a couple of records I would like to do an update on all the imported records.
The update should run automatically and insert a combination of the recently inserted auto_increment (v_id, my primary key) and another populated field of the table.
If I try it with an afterInsert function it gives me an error because the auto_incremet is not actually there I suppose.
- Code: Select all
function afterInsert($record) {
$app =& Dataface_Application::getInstance();
$record =& $app->getRecord();
$vid = $record->val('v_id');
$B3IDresult = $record->val('B3_ID_result');
$sql = mysql_query("UPDATE versuch SET v_b3_ID='$B3IDresult | $vid' WHERE v_id = $vid");
}
gives back: Fatal error: Call to a member function val() on a non-object in C:\xampp\htdocs\webseiten\biogasdb.lokal\tables\versuch\versuch.php on line 47 where line 47 is: $vid = $record->val('v_id');
which means that the auto_increment v_id is not in place.
When I try an afterSave trigger it will work on every single record after saving. This would probably be a possibility but you have to save every single of the imported records manually (could be many).
Any Idea?
Thank you
Markus