This topic is locked

Copy field details from Master table to Detail Table

2/11/2018 11:54:34 PM
PHPRunner General questions
G
gagsoft author

I have a master Table called "logs" and a detail table called "Activities".

The detail table is linked to the master table by field "LogID"

I want to copy a field's details called email to the detail table in order to use it with the after record added event

to facilitate an email send.
Any pointers would be appreciated.
Thanks

Peter G

admin 2/12/2018

Normally data duplication is a bad idea. What if email in master tables changes at some point?
If you need to send an email in AfterAdd event and email address is stored in the master table - you can use getMasterRecord API to access that email address:

https://xlinesoft.com/phprunner/docs/getmasterrecord.htm

G
gagsoft author 2/13/2018

I am testing the getMasterRecord() function with an echo to see if it works but nothing happens after the record was saved.

The code as follows:
$data = $pageObject->getMasterRecord();

echo $data["EMAIL"] ." ".$data["ITEMDESCRIPT"];
"Email" and "itemdescript" fields are two fields from the Master record which I would like to use sending the email.

admin 2/13/2018

It will work if you get field names right (case-sensitive).