Uma forma para isso, no form mestre, utilize as macros do SC.
No evento: onAfterUpdate
/**
- Update a record on another table
*/
// SQL statement parameters
$update_table = ‘my_table’; // Table name
$update_where = “field_3 = ‘condition’”; // Where clause
$update_fields = array( // Field list, add as many as needed
“field_1 = ‘new_value_field_1’”,
“field_2 = ‘new_value_field_2’”,
);
// Update record
$update_sql = ‘UPDATE ’ . $update_table
. ’ SET ’ . implode(’, ', $update_fields)
. ’ WHERE ’ . $update_where;
sc_exec_sql($update_sql);
Ou a macro:
/**
- Insert a record on another table
*/
// SQL statement parameters
$insert_table = ‘my_table’; // Table name
$insert_fields = array( // Field list, add as many as needed
‘field_1’ => “‘new_value_field_1’”,
‘field_2’ => “‘new_value_field_2’”,
);
// Insert record
$insert_sql = ‘INSERT INTO ’ . $insert_table
. ’ (’ . implode(’, ‘, array_keys($insert_fields)) . ‘)’
. ’ VALUES (’ . implode(’, ', array_values($insert_fields)) . ‘)’;
sc_exec_sql($insert_sql);