![]() |
ChatGPT 6/19/2025 |
It sounds like you're trying to update a field in a detail table based on a value from the master table in PHPRunner, but you're encountering the issue where Here are a few steps to troubleshoot and possibly resolve your issue:
Here’s a simple example of how you might implement this:
|
M
|
Mallorca1 author 6/19/2025 |
I tried all this and other sulutions from geminiAI but not working, I always just get the first record of the table which is master with getMasterRecord(). Lookup will not work since the detail table has not enough info to find the exact master record. |
C
|
copper21 6/19/2025 |
If the button you are putting is in the row (grid) of the child list page, then this works for me when viewing the child list page from the master page: Server Tab of button: $record = $button->getMasterRecord(); $sql1 = DB::PrepareSQL("SELECT * FROM MasterTable WHERE PrimaryKey = :1", $record['ID']); This should return the data from the master table for that specific record. You will have to change "MasterTable" with the table name, "PrimaryKey" with your primary key field, and "ID" with the name of your primary field name. |
M
|
Mallorca1 author 6/20/2025 |
Unfortunately also this is not working since getMasterRecord() is not outputing the data which is displayed in the master it is always outputing the first row of the table of the master. This Button (Server code) I have in the row of the detail list page: $record1 = $button->getMasterRecord(); $datavalues = array(); $record2 = $button->getCurrentRecord(); $keyvalues = array(); DB::Update("briefings", $datavalues, $keyvalues); /// Alternative this is having the same result: $record1 = $button->getMasterRecord(); $datavalues = array(); $record2 = $button->getCurrentRecord(); $keyvalues = array(); DB::Update("briefings", $datavalues, $keyvalues); |
C
|
copper21 6/20/2025 |
I think I understand what you are trying to do. I wrote this: //Get Master Record ID & Master Data //You Don't Need This If You Just Need Master Record Primary Key //Get Child Record Data $data3 = array(); If all you need is the master primary key, then you don't need to use the 3 lines of code under "//You Don't Need....." $record2 will get your child record's primary key. If all you need to do is update the "appointmentid" field in the child table, with the primary key of the master table, this should work. Make sure the button is in the grid/row.
Make sure that the child and master tables are connected in the "Tables" section. |
M
|
Mallorca1 author 6/21/2025 |
Thank you but still I just get the id of the first row of the master table not the id of the displayed row of the master table. More details: |