PopUpForm [message #4241] |
Fri, 06 June 2014 11:09 |
htManager
Messages: 433 Registered: May 2014
|
Senior Member |
|
|
Hi Tony,
I have created a popUp Task which shows me the entries of a lookup table and inserts the PKey-Fields (user_id, user_seq_no) in the child table.
Now I want to get additional field values (user_name, user_firstname) from the parent table for also inserting in the child table. The $select_array contains only the pkey values.
How can I get these additional values best?
Best regards,
Juergen
|
|
|
Re: PopUpForm [message #4242 is a reply to message #4241] |
Fri, 06 June 2014 11:22 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
By default the popup form will only return the primary key of the selected entry. There ate two ways to obtain other (non-key) values:
(1) Use the _cm_getPkeyNames() method in the popup form to add extra field names to the list of primary key fields.
(2) After returning to the form which called the popup you may insert code to read the record with that primary key. This will give you access to all the data on the selected record. You can put code in the _cm_popupReturn() method or the _cm_post_popupReturn() method.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: PopUpForm [message #4246 is a reply to message #4245] |
Sat, 07 June 2014 08:18 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Do not use the $dbobject_dml_getData() method , use $dbobject->getData() instead.
When you construct the WHERE string you must remember to enclose non-numeric values with single quotes.
The result returned by getData() is a 2-dimensional array which is keyed by row numnber, with the value being an associative array of name=value pairs. Your code should therefore look like this:
$dbobject =& RDCsingleton::getInstance('htm_db_kontakte');
$where = "kontakt_name='{$select_array['user_id']}' AND kontakt_vorname='{$select_array['user_seq_no']}'";
$data = $dbobject->getData ($where);
if (!empty($data) {
$data = $data[0];
$fieldarray['kontakt_ma_name'] = $data['kontakt_name'];
$fieldarray['kontakt_ma_vorname'] = $data['kontakt_vorname'];
} // if
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|