This topic is locked

transfer masterkey into details/details!?!

8/21/2006 6:42:32 AM
PHPRunner General questions
scuba author

I have three tables:

  1. companies (master)
  2. contacts (details of companies / master of inquiries)
  3. inquiries (details of contacts)
  4. companies-table (master) handles over to contacts-table (details) by "comp_id" (masterkey).
  5. contacts-table (<<details / master >>) handles over to inquiries-table by "con_id" (masterkey).
    But I also need "comp_id" handled to inquiries-table on default when a record is added there. I have it in contacts-tabel since it is the masterkey from companies-table. How can I get it into inquiries from there?


is there a way to do that within PHPRunner without modding code in generated php-files?

thanks for any adwise in advance

J
Jane 8/21/2006

Hi,
you can do it using events.

Proceed to the Events tab, select ListOnLoad event for the CONTACTS table and put your code in it.

Here is a sample code:

function ListOnLoad($strSQL)

{

global $strTableName;

$_SESSION["compid"] = $_SESSION[$strTableName."_masterkey"];

}



and then use $_SESSION["compid"] as default value for the INQUIRIES table on the Edit format dialog on the Formatting tab.