This topic is locked

Find the detail(child) table list of a master(parent) table

6/22/2008 12:37:49 AM
PHPRunner General questions
M
mnhuda author

Hello,

I have a master detail table relationship say, Mastertable (Primarykey1) and Detailtable1(Foreignkey1=Primarykey1), Detailtable2 (Foreignkey2=Primarykey1)..... etc. Before deleting a row from Mastertable I want to (1) insert the related records of Detailtable1 and Detailtable2 into BackupDetailtable1 and BackupDetailtable2 respectively, (2) delete related records of Detailtable1 and Detailtable2. (I could do it at the database level if I didnt need to insert the related records if detailtables into backupdetailtables.)
I could do the above by adding codes for each of the detail tables in the BeforeDelete event. However, I don't want to hardcode this process for every detail table. So, I need to get the list of detail table list of the Mastertable so that I can pass the list in the BeforeDelete and then process for each of the detail table. Could you please help me with this problem?
Thax in advance.

J
Jane 6/23/2008

Hi,
to remove record from details table use BeforeDelete event.

Unfortunately you can't join code for two different tables.

M
mnhuda author 6/23/2008

Hi,

to remove record from details table use BeforeDelete event.

Unfortunately you can't join code for two different tables.


Hello Jane,

Thax for your reply. I understand that I should use BeforeDelete event. For this, if I a master table has 4 detail tables, I need to write seperate code blocks for each of the 4 detail tables. What I want to know is does PHPRunner maintain some variable which stores the list of detail tables for a particular master table (If I set master detail relationship in the project)? If such variable exists then I can use the same code block to delete records from all of the 4 detail tables.

J
Jane 6/24/2008

Hi,
I see what you're saying.

Unfortunately there are no such variables.