This topic about the multi-select lookup fields was very helpful:
https://bigprof.com/blog/appgini/a-work ... gini-apps/
With just a slight change it works nice to filter by the SelectedID or any other field in DV:
You just need to call the function once in the yourtable_init function in yourtable.php hook file like this:
Code: Select all
function proceedings_init(&$options, $memberInfo, &$args) {
update_parties_list();
return TRUE;
}
And my function looks like this:
Code: Select all
function update_parties_list()
{
if($_POST['SelectedID']!='')
{
$parties = array();
$res = sql("SELECT `parties`.`name` AS pname, `participant_types`.`name` AS tname FROM `parties`, `participant_types`, `participants`, `proceedings` WHERE
`proceedings`.`id` = '".$_POST['SelectedID']."' AND `participants`.`case` = `proceedings`.`case` AND `participants`.`party` = `parties`.`id` AND
`participants`.`participant_type` = `participant_types`.`id`", $eo);
while($row = db_fetch_assoc($res))
$parties[] = $row['tname']." - ".$row['pname'];
// save the parties to the options list file
$list_file = dirname(__FILE__) . '/proceedings.parties.csv';
@file_put_contents($list_file, implode(';;', $parties));
}
}