October 15, 200619 yr Newbies Hello, I'm very new to FM although I do have extensive SQL skills(maybe that's why I'm not really getting anywhere with FM). Anyway, I have a database with a Parent-Child(one-to-many) relationship between two tables, one for Bank Accounts, and one for Transactions. On the transaction form, I have a button to execute a script. What that script does is to: 1. delete current record 2. go to related record(in this case, the bank account the record -- the record that has just been deleted -- belonged to) The script works fine when there is more one transaction in a bank account(I think it's because even the current record has just been deleted, there are still other transaction left for the relation to work). However, when there is only one transaction left, after deleting the current record, there is no more record left to make the relation, and I can't get back to the related bank account anymore. So, is there anyway(using variable or not, ...) to "remember" what the related record was before, delete the current record, then go to the related record? Thanks
October 15, 200619 yr First execute the GTRR to select the correct parent record, go back to the child and then delete it. Finally simply change the layout back to the parent. Jens Edited October 15, 200619 yr by Guest
October 15, 200619 yr You might try it the other way around: Go to Related Records [ Show only Related Records ; layout: Child Layout ] Go to Layout [ Parent Layout ] Delete Record [] Go to Layout [ Child Layout ] Or you can capture the parent RecordID, delete the parent, then navigate to the child layout and perform a Find for those child records with that parent RecordID as the foreign key.
October 16, 200619 yr Author Newbies Thanks for all your help! I got the script working as follow: Set Variable [ $parentRecordID; Value:transaction::account_id ] Delete Record/Request Go to Layout [ “account” (account) ] Enter Find Mode [] Set Field [ account::id; $parentRecordID ] Perform Find []
October 16, 200619 yr You can also set up the relationship so that when a parent record is deleted, the child records are automatically deleted. But, you need to be careful with that option.
Create an account or sign in to comment