J
|
Jane 3/12/2007 |
Vitas, |
V
|
vytb author 3/12/2007 |
Vitas, you can make your calculations in the Before record added or Before record update events on the Events tab.
|
J
|
Jane 3/12/2007 |
Vitas, |
V
|
vytb author 3/12/2007 |
Vitas, it's difficult to tell you what's happening without seeing actual data. Post your table structure and your calculations and I'll try to help you.
|
J
|
Jane 3/14/2007 |
Vitas, function BeforeAdd(&$values) { //select value of field1 from master table global $conn,$strTableName; $str = "select field1 from MasterTable where ForeignKey=".$_SESSION[$strTableName."_masterkey1"]; $rs = db_query($str,$conn); $data = db_fetch_array($rs); //calculate field3 $values["field3"] = $data["field1"]+$values["field2"]; return true; } |
V
|
vytb author 3/15/2007 |
Vitas, here is a sample code:
|
J
|
Jane 3/16/2007 |
Vitas, function BeforeAdd(&$values) { //select value of field1,field2 from master table global $conn,$strTableName; $str = "select field1,field2 from table1 where field_a=".$_SESSION[$strTableName."_masterkey1"]; $rs = db_query($str,$conn); $data = db_fetch_array($rs); //calculate field3 $values["field3"] = $data["field1"]+$data["field2"]; return true; } |