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

Home » RADICORE development » Framework » DropDown Field values - changing in runtime
Re: DropDown Field values - changing in runtime [message #7695 is a reply to message #7694] Wed, 09 March 2022 05:09 Go to previous messageGo to previous message
htManager is currently offline  htManager
Messages: 417
Registered: May 2014
Senior Member
Sorry for my English and how I try to explain what I mean.

The field gr_art_dropdown ('Größe (Art) auswählen')is a field with a dropdown list. It will be filled with the description of the size categories (shoes, cloths, etc.).
The field gr_art_ausr ('Größe') is the field where you can choose the right size of the chosen category.
The field ma_ausruestung_preis_eigenanteil ('Eigenanteil') is the field which holds the part of the total cost which will be payed by the team member.

I added two screen shots: the initial and a changed one. Hopefully you can see what I tried to explain. I added the code of the _cm_getValRep() method of the table from where the values come.

In the screenshot you see in 'Größe (Art) auswählen' the category of the size (shoes, cloth, etc.). And in 'Größe' the selectable values. In 'Eigenanteil' you see the value of the money (50.00, 5000,00).
In the green circle you can see the individual values of the compound foreign key which identify the key for filling the field 'Größe' with the right values.

// ************************************************************ ****************
function _cm_getValRep ($item=null, $where=null, $orderby=null)
// get Value/Representation list as an associative array.
{
$array = array();

switch ($item) {

case 'groessen_art_ausr_kopf' :

// get data from the database
$this->sql_select = 'gr_art, gr_art_sub, rdcaccount_id, ausruestungs_groesse_art_desc';

$this->sql_orderby = 'ausruestungs_groesse_art_desc';
$this->sql_ordery_seq = 'asc';

$data = $this->getData($where);

// convert each row into 'id=desc' in the output array
foreach ($data as $row => $rowdata) {

$key = '&' . $rowdata['gr_art'] . '&' . $rowdata['gr_art_sub'] . '&' . $rowdata['rdcaccount_id'];
$array[$key] = $rowdata['ausruestungs_groesse_art_desc'];

} // foreach

return $array;

case 'groessen_art_ausr_detail' :

// ermittelt den Primärschlüssel

if (isset($GLOBALS['gr_key_array'])) {
$primary_key_values = $GLOBALS['gr_key_array'];
} else {

$primary_key_values['1'] = $GLOBALS['fieldarray']['gr_art'];
$primary_key_values['2'] = $GLOBALS['fieldarray']['gr_art_sub'];
$primary_key_values['3'] = $GLOBALS['fieldarray']['gr_art_rdc'];
}

// get data from the database
$this->sql_select = 'orga_groessen_ausr_detail.gr_art_ausr, orga_groessen_ausr_detail.argroesse_desc';

$this->sql_from = "orga_groessen_ausr " .

" LEFT JOIN orga_groessen_ausr_detail ON (" .

"orga_groessen_ausr_detail.gr_art = orga_groessen_ausr.gr_art AND " .
"orga_groessen_ausr_detail.gr_art_sub = orga_groessen_ausr.gr_art_sub AND " .
"orga_groessen_ausr_detail.rdcaccount_id = orga_groessen_ausr.rdcaccount_id)";

$this->sql_orderby = 'argroesse_desc';
$this->sql_ordery_seq = 'asc';

$where = "gr_art = '{$primary_key_values['1']}' AND " .
"orga_groessen_ausr_detail.gr_art_sub = '{$primary_key_values['2']}' AND " .
"orga_groessen_ausr_detail.rdcaccount_id = '{$primary_key_values['3']}'";

$data = $this->getData($where);

// convert each row into 'id=desc' in the output array
foreach ($data as $row => $rowdata) {

$rowvalues = array_values($rowdata);
$array[$rowvalues[0]] = $rowvalues[0] . ' - ' . $rowvalues[1];

} // foreach

return $array;

} // switch

return $array;

} // _cm_getValRep

[Updated on: Wed, 09 March 2022 09:03]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: SQL with concat() - cannot extract token from
Next Topic: List pattern - fields of joined tables disappear by reset
Goto Forum:
  


Current Time: Thu May 16 03:22:32 EDT 2024

Total time taken to generate the page: 0.02109 seconds