Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » Dropdown list (same option list for different colomns)
Dropdown list [message #4277] Sun, 22 June 2014 04:06 Go to next message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
Hi Tony,

I try to use the same option list in the text/<language>/language_array.inc file to serve different colomns in different tables.
The colomn names are different as you discribed in one of your articles.
But only if I name the option list as the colomn name it will be filled. I used the sample in Tutorial 5 (5. Convert STAR_SIGN into a dropdown list).

function _cm_getExtraData ($where, $fieldarray)
// get values for star_sign and insert into lookup array
$array = $this->getValRep('star_sign');

In this line I thought to put the different column name:
$this->lookup_data['different_column_star_sign'] = $array;

Is this correct or am I wrong?

Best regards,

Juergen
Re: Dropdown list [message #4278 is a reply to message #4277] Sun, 22 June 2014 16:28 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
While it is usual to name the option list after the column to which it belongs, it is not mandatory. This is why the data dictionary allows you to specify whatver name you want. In this way you can use the same list for multiple fields.

Re: Dropdown list [message #4279 is a reply to message #4278] Mon, 23 June 2014 03:45 Go to previous messageGo to next message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
I also thought so but it doesn't work with me. Do I have to take attention of something else or is something wrong with my code?

Here is my code:

function _cm_getExtraData ($where, $fieldarray)
// Perform custom processing for the getExtraData method.
// $where = a string in SQL 'where' format.
// $fieldarray = the contents of $where as an array.
{

// get values for groesse_international and insert into lookup array
$array = $this->getValRep('groesse_international');
$this->lookup_data['kontakt_ausruestung_groesse_international'] = $array; // colomn of the table

return $fieldarray;

} // _cm_getExtraData

function _cm_getValRep ($item, $where)
// get Value/Representation list as an associative array.
{
$array = array();
if ($item == '_groesse_international') {
$array = getLanguageArray('groesse_international');
return $array;
} // if

return $array;

} // _cm_getValRep
Re: Dropdown list [message #4280 is a reply to message #4279] Mon, 23 June 2014 03:58 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
When you say "it doesn't work" what exactly do you mean? Is your array of values which you insert into $this->lookup_data empty? Or can't you load this list into your dropdown?

Whatever name you use for each list in $this->lookup_data MUST be the same as you assign to 'Option List' in the 'Update Column' screen in the data dictionary. This name need not be the same the column name, but it must point to an entry in $this->lookup_data.


Re: Dropdown list [message #4281 is a reply to message #4280] Mon, 23 June 2014 04:06 Go to previous message
htManager is currently offline  htManager
Messages: 415
Registered: May 2014
Senior Member
Thank you for the last response. I now understand how it works. The relation between the option list and the values is made in the data dictionary and not in the class! I thought that also in the class file there must be an entry for the colomn.
I changed the correct option list name in the class file and everything works fine now.

Thank you very much.
Previous Topic: PopUpForm
Next Topic: eMail sent automatically
Goto Forum:
  


Current Time: Thu Mar 28 07:40:30 EDT 2024

Total time taken to generate the page: 0.01354 seconds