This topic is locked

Master-detail and detail of detail table

1/26/2020 5:28:03 AM
PHPRunner General questions
I
Imran Minhas author

Good day everyone, I am a new user for PHP web application and I need little help from experts, let me try to explain in as simple as possible way but sorry in advance if I would not made myself clear
I am trying to create a form having 3 tables. let us assume its a store management system where I have to make out-pass for a user.
so I have a out-pass form with user information and 2nd detail page for items he is taking, until here its clear, I have done with Master-detail setup.
now I want to have another 3rd table linked with detail page for serial numbers linked to items in detail page, each item user is taking I want to add serials of items he is taking but I tried my level best to get 3 tables linked in series but failed, I can not see all three pages, I even try to add a button in detail table so it can open popup link for this record but again failed
can please anyone help me get what I require in simple way, lets hope I managed to explain my problem properly.
Thanks in advance

A
AlphaBase 1/26/2020

Hhmm.. I tried that and it does link the 3 tables, but it only shows a couple of the detail records on table 2, so it doesn't work correctly.

I
Imran Minhas author 1/30/2020



Hhmm.. I tried that and it does link the 3 tables, but it only shows a couple of the detail records on table 2, so it doesn't work correctly.


Thanks for the try. I am still not able to fix my issue, may be I am doing a wrong design.

S
Steve Seymour 1/30/2020



Thanks for the try. I am still not able to fix my issue, may be I am doing a wrong design.


I had a similar issue a while back. It seemed at the time that PHPR looked for all the fields when matching a detail record. A field in the master table had been changed and for some still unknown reason PHPR didn't recognize the master record as the master for the previous details.

....

That is... I had edited a field (non key field) in the master table then added new detail, the previous detail wasn't displayed.

As the project was still in development, I was able to edit the detail (re-enter) to solve the problem.
https://asprunner.com/forums/topic/26869-details-view/pagep89295fromsearch1&#entry89295

A
acpan 1/30/2020

Not really clear if you are trying to display your data in grid or do a ADD form with master-details table, and not sure how your tables are structured (how each table links to another).
So i am not sure if the other replies here actually addressing your issues or talking about something else. Other seems to be talking about display master and 2 child tables in grid or Add form and you seemed to talking about an Add form with a master and child table and the child table needs a simple lookup to a 3rd table for serial number.
If you are talking about an Add form (master-details), and want the serial number to display from another 3rd table, can't you use a lookup pull down on the details form to show the serial number? Why do you need to link detail table to another 3rd table?
Or
If you simply want to add the serial number to detail or master table (as what you said: "each item user is taking I want to add serials of items he is taking", you can do so in Before Record Updated event, do a SQL query to get the serial from the 3rd table before the data is saved.
To lookup serial from 3rd table:
Before Record Updated Event:



// Get the serial number from another table

$rs = DB::Query("select serial_no from inventory Where ... ");

while( $data = $rs->fetchAssoc() )

{

$serial = $data["serial_no"];

}
// assign values for serial number field to be update

$values["serial_number"] = $serial;


Or all you want is to add new serial into 3rd table, you can do the same by SQL Update/Insert instead of SQL Query above.
ACP