Skip to content

Function "pool_select_update()"

bool pool_select_update(numeric $gtabid, numeric $fieldid, numeric $ID, array $update_values);

This function allows editing entries from selection pools. These can be of type selection or attribute.

Parameters:

The transfer parameters are inserted, where needed, in the return array.

$gtabid

  • Table-ID of the table that contains the field with the link

$fieldid

  • Field-ID of the field with the link

$ID

  • ID of the record for which records from the linked table are to be added, deleted or displayed

$update_values

  • Array containing the instructions. The array is structured as follows:
    • 'action' - action, a = add; d = delete; v = change attribute value
    • 'wid' - W_ID of the linked record from [LMB_SELECT_W]
    • 'id' - ID of the linked record from [LMB_SELECT_D] / [LMB_ATTRIBUTE_D]
    • 'value' - attribute value

You can specify the ID of the linked record (LMB_SELECT_D), the W_ID of the pool entry (LMB_SELECT_W) or both. If the pool's "multiple mode" is activated, the ID is necessary for clear identification since pool entries can occur multiple times.

Examples

These examples should be applied to a table with ID 2 and its field with ID 3 as well as to the data record 123.

This example adds the value with ID 12 from a selection pool (defined by the field type) and deletes the value with ID 11.

$update_values[] = array('action'=>'a','wid'=>12);
$update_values[] = array('action'=>'d','wid'=>11);
pool_select_update(2, 3, 123, $update_values);

This example adds the value with ID 12 from a selection pool (defined by the field type) and changes the attribute value to 'Limbas'

$update_values[] = array('action'=>'v','wid'=>12, 'value'=>'Limbas');
pool_select_update(2, 3, 123, $update_values);

This example changes the value of the attribute with W_ID 12 in 'Limbas 1' and the value of the attribute with ID 13 in 'Limbas 2'. A distiction is made as to whether ID or W_ID is used for indentification. For pools with active "multiple mode", it is advised to use ID from [LMB_SELECT/ATTRIBUTE_D], otherwise all values with the same W_ID would be changed.

$update_values[] = array('action'=>'v','wid'=>12, 'value'=>'Limbas 1');
$update_values[] = array('action'=>'v','id'=>13, 'value'=>'Limbas 2');
pool_select_update(2, 3, 123, $update_values);