Hello all - I'm trying to filter my results for a lookup field via the advanced option to not include user records from another table.
I was going to simply uncheck the "Show all records of the parent table" option and modify the query with a nested query, but I'm not sure how given I can't include the user name.
Basically I want to see the records from that user, but not if that record already exists in the alternates table. Any ideas? Thanks in advance.
WHERE ID NOT IN Advanced Lookup Issue
Re: WHERE ID NOT IN Advanced Lookup Issue
Hi,
I don't think you can do this via the customization of the advance query option. Instead you need to put your query together in the hooks/FILENAME.php file within the INIT function.
Set the
$options->QueryWhere = 'WHERE ....';
to your needs.
Here you can grap the actual user from the $memberInfo array.
I don't think you can do this via the customization of the advance query option. Instead you need to put your query together in the hooks/FILENAME.php file within the INIT function.
Set the
$options->QueryWhere = 'WHERE ....';
to your needs.
Here you can grap the actual user from the $memberInfo array.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: WHERE ID NOT IN Advanced Lookup Issue
Thank you but it appears that they QueryWhere is filtering the main table display, not the dropdown list which is controlled by the Advanced lookup options. Maybe they will introduce a LookupQueryWhere option in the future. Is there any other way to solve this?
Re: WHERE ID NOT IN Advanced Lookup Issue
I solved this by creating an insert hook that checks for duplicates in the parent table before it allows the insert. So you can still select and attempt to add a duplicate, but it will stop you.