here is how I solved the problem. It works great.
in exams.pl define:
$WBB{'afterTableModify'}='if ($Action =~ /^cgiDelete/)
{&DeleteLinkedRecords(students, "data:$rec{_id}");}';
sub DeleteLinkedRecords {
local($linkedtable, $search)=@_;
local($mes, $message);
local($ids)=&ROWS($linkedtable, "_id", $search);
foreach $id (split("\n", $ids)) {
undef $mes;
$mes = &LinkedRecDelete($linkedtable, $id);
if ($mes) {
$message .= "$mes<BR>";
}
else {
$message .= "record: $id from table $linkedtable deleted!<BR>";
}
}
print "<P>$message";
}
sub LinkedRecDelete {
local ($linkedtable, $id, $keepAttach)=@_;
if ($id eq '' || $id =~ m/^[\*\?\.]/) {
return("Cannot delete record with id=$id");
}
local($dir) = &wbTables('DIR',$linkedtable);
open (h,">>$dir/_data/fat.txt");
binmode(h);
print h "$id\t-1\n";
close(h);
if (!$keepAttach) {
chdir ("$dir/att") || return("Cannot chdir to $dir/att");
local(@all,$x);
@all = &glob("$id.*");
foreach $x (@all) {
unlink "$x" || return("Could not delete $x");
}
}
}
--
Dr. Claudio Rivetti