Master Details : Edit and delete ... on cascade mode

Dear all,

I’ve done a M/D form but when I finished it I realize that I have no possibility to control in some way the relationship between master fields and details and also about actions done later on.

On master form I have a registration date that I copy also in each rows (details (OK it’s redundant but I have to do so) ) as variable inherit from master form.

If I later go to edit the master form part I can modify this date but obviously all the connected rows remain the same of creation time. I have tried using on-change over the M form date but no infos about rows are available.

The same I think if I go to delete the master record. How can I do a similar operation “on cascade” for details rows without using complex sql command.

Is there a simple way to do these things ?
Many thanks
Giovannino

Re: Master Details : Edit and delete … on cascade mode

Hi giovannino,

registration date: create an sql command for child row update in the master form (Event onAfterUpdate)

on cascade: your master form / Master/Detail Form / select link / Other Properties / when deleting => “also delete child rows”

HTH

Re: Master Details : Edit and delete … on cascade mode

Dear Rhs,

I’m trying something like that for date update. Is it what are you suggesting ?
If you have several rows on details is it works the same ?
dayly_in_m --> Master
dayly_in --> Details
date --> field to update taking value from dayly_in_m.date

/**

  • Update a record on another table
    */

// SQL statement parameters
$update_table = ‘dayly_in’; // Table name
$update_where = “dayly_in.dayly_in_m = ‘dayly_in_m.id_dayly_in_m’”; // Where clause
$update_fields = array( // Field list, add as many as needed
“dayly_in.date = ‘dayly_in_m.date’”,
);

// Update record
$update_sql = ‘UPDATE ’ . $update_table
. ’ SET ’ . implode(’, ', $update_fields)
. ’ WHERE ’ . $update_where;
sc_exec_sql($update_sql);

Many thanks
Giovannino

Re: Master Details : Edit and delete … on cascade mode

I did also the second part --> “also delete child rows”
and it works fine !!
Thanks a lot
Giovannino