A
|
acpan 8/15/2019 |
Probably no need to do join query, suggestion: |
A
|
AndrewMark author 8/15/2019 |
Probably no need to do join query, suggestion: In App init (After Application Initialised) event: Query the data from Table A using the User ID and store in SESSION variables. At the Add new form for Table B, assigned the field values with the session variables. ACP
|
A
|
acpan 8/15/2019 |
It has to work, this is pretty straight forward. Can't help by reading your "stories". |
![]() |
Sergey Kornilov admin 8/15/2019 |
Your description is not very clear. I don't think a JOIN can help here. You are on the Add page, the record doesn't exist yet and there is nothing to join with. |
A
|
acpan 8/16/2019 |
Try this: First, don't do any join for your SQL query. i.e. table A and table B are seperated. |
A
|
AndrewMark author 8/16/2019 |
Try this: First, don't do any join for your SQL query. i.e. table A and table B are seperated. In process record values event of table B's Addnew form: // Get table A values with $_SESSION["your_user_id"] $rs = CustomQuery("select Afield1, Afield2 from tableA where user_id = ".$_SESSION["your_user_id"]); $data = db_fetch_array($rs); // check if you get the right data, disable in production echo json_encode($data); // Assign table A values to table B fields $values['Bfield5'] = $data["Afield1"]; $values['Bfield3'] = $data["Afield2"]; // When click addnew for table B, the values from Table A will be shown on table B's form.
|
A
|
acpan 8/17/2019 |
Hi, Assign Values: RequestedEntityName =".$values['RequestedEntityName']." | RequestedEntityType =".$values['RequestedEntityType']." | RequestedEntityABN =".$values['RequestedEntityABN']; |
A
|
AndrewMark author 8/17/2019 |
Hi, Your $_SESSION['$ID'] is not defined. You can just use $ID directly. Try this: In process record values event of table B's Addnew form: // Get orders table's values with OrderID $ID=$values["OrderID"]; $sql = "select EntityName, EntityType, ABN, OrderID from orders where OrderID = $ID"; $rs = DB::Query($sql); $data = db_fetch_array($rs); // check if you get the right data and if SQL is valid, disable in production echo "SQL=$sql | Result=".json_encode($data); // Assign table A values to table B fields $values['RequestedEntityName'] = $data["EntityName"]; $values['RequestedEntityType'] = $data["EntityType"]; $values['RequestedEntityABN'] = $data["ABN"]; // check if you data assigned properly, disable in production echo " Assign Values: RequestedEntityName =".$values['RequestedEntityName']." | RequestedEntityType =".$values['RequestedEntityType']." | RequestedEntityABN =".$values['RequestedEntityABN'];
|