PopUp changes Key fields [message #7158] |
Wed, 20 June 2018 03:04 |
htManager
Messages: 433 Registered: May 2014
|
Senior Member |
|
|
Hi Toni,
I have a detail screen (upd1) in which I can call a popup (popup1) to change the corresponding values of a foreign key. After PopUp-Return the key fields of the record are also changed. The first three fields in both tables have the same name.
The popup fills in the correct values but the following error message appears:
Could not locate original ORGA_MANNSCHAFTEN_KONTAKTE record for updating (verbaende_art_id='LV' AND verbaende_kuerzel='HV S' AND vereine_kuerzel='SCA' AND saison_id='2017/2018' AND mannschaften_id='2005W' AND kontakt_ma_user_id='HTM' AND kontakt_ma_user_seq_no='195' AND kontakt_ma_user_rdcaccount_id='7')
What did I wrong?
Best regards,
Juergen
|
|
|
|
|
Re: PopUp changes Key fields [message #7161 is a reply to message #7160] |
Thu, 21 June 2018 04:42 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Can you provide a copy of your dict.inc file so that I can see your relationship details and the fieldspecs for the affected columns?
If the popup is returning columns with the names 'verbaende_art_id', 'verbaende_kuerzel' and 'vereine_kuerzel' then these columns will be copied across to your $fieldarray. If the column names in your $fieldarray are different then you need to delete the contents of $select_array after you have copied them to $fieldarray.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: PopUp changes Key fields [message #7163 is a reply to message #7162] |
Fri, 22 June 2018 05:05 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
What is the relationship between 'kontakt_stamm_verbaende_art_id' and 'verbaende_art_id'?
Which is returned from the popup form and which is saved in your $fieldarray?
Which do you NOT want stored in your $fieldarray?
If you want the value for 'verbaende_art_id' stored as 'kontakt_stamm_verbaende_art_id' and not 'verbaende_art_id' then you must remove it from $select_array before you exist from _cm_popupReturn().
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: PopUp changes Key fields [message #7165 is a reply to message #7164] |
Sat, 23 June 2018 04:28 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
There is no screen shot, so I cannot see anything. You have given me the dict file for table 'orga_mannschaften_kontakte' and say that the popup data is being provided from table 'orga_vereine', but I cannot see any relationship between these two tables.
The whole purpose of a popup is to provide values from a record which you have selected from another table, and these values are provided in $select_array. By default these values will be copied into $fieldarray, thus overwriting those fields with the same names. If you don't want any values to be overwritten then you must remove them from $select_array before you exit from _cm_popupReturn().
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: PopUp changes Key fields [message #7167 is a reply to message #7166] |
Mon, 25 June 2018 04:34 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
There is no reference to table 'orga_vereine' in the dict.inc file which you provided.
$fieldarray and $select_array are both associative arrays, and the default behaviour is to copy the contents of $select_array into $fieldarray. However, instead of using a simple array_merge() there is code in the popupReturn() method of std.table.class.inc that uses the field mapping in the $parent_relations entry to copy from $fld_parent to $fld_$child. If this field mapping is causing a problem then you need code in your _cm_popupReturn() method to move values from $select_array to $fieldarray using the names that you want, then you erase the contents of $select_array.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|