Hello,
Is there a way to restrict which records a Lookup field returns?
So if I have a table with a field that indicates if each record is either "Active" or "Obsolete".
How can I restrict a lookup field in a form to only show the records from the table which are marked as "Active" to be shown for selection?
Thanks,
Paul
Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Filter/Restrict Lookup Results?
Re: Filter/Restrict Lookup Results?
Thanks kev1n, tried that by putting
in the js section of the lookup but it didn't seem to work as the lookup showed all the results. Not sure if it's the wrong place for it but wasn't sure where else it would go.
However, tried another approach of cloning the form that had the info I needed in it and adding to the SQL of the cloned form in the Browse section of the form's properties. This seems to be working as it gave me th filtered results I was looking for.
Thanks for your help
Code: Select all
nuSetProperty ('iri_status', 'Active');
However, tried another approach of cloning the form that had the info I needed in it and adding
Code: Select all
SELECT * FROM ink_reference_information where iri_status = "Active"
Thanks for your help

-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
Re: Filter/Restrict Lookup Results?
Set the Hash Cookie in the onfocus event:
Then in the Lookup form:
Code: Select all
nuSetProperty ('iri_status', 'Active');
Code: Select all
SELECT * FROM ink_reference_information where iri_status = "#iri_status#"
Re: Filter/Restrict Lookup Results?
Tried that but doesn't work for me either. Don't worry about it, happy enough with the other method I found fo using the cloned form (got the idea from one of your previous suggestions on cloning and editing the user management forms for other users) as it allows me to filter the info out that I don#t need.
What I did was:
Set the onfocus event in the lookup object Custom Code, then added the SELECT statement to the SQL in the Lookup tab of the lookup object. on using the lookup on the form it's part of it still displays all records. The form I'm using to look up the records is the same one used for data entry, so creating the clone of it and using a select statement to limit the info displayed seems to work fine.
What I did was:
Set the onfocus event in the lookup object Custom Code, then added the SELECT statement to the SQL in the Lookup tab of the lookup object. on using the lookup on the form it's part of it still displays all records. The form I'm using to look up the records is the same one used for data entry, so creating the clone of it and using a select statement to limit the info displayed seems to work fine.
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 446 times
- Contact:
Re: Filter/Restrict Lookup Results?
I created a small example "Popup Filter"
Maybe you'll discover what I did differently from you.
Maybe you'll discover what I did differently from you.
Re: Filter/Restrict Lookup Results?
Cool, now see what you meant.
You have: end user can select filter option, then search via lookup. I needed a non-end user selectable pre-filter (using the restricted form) so that no choice of what can be filtered is possible.
Sorry if I didn't explain the requirements properly but interseting to see that option available too
You have: end user can select filter option, then search via lookup. I needed a non-end user selectable pre-filter (using the restricted form) so that no choice of what can be filtered is possible.
Sorry if I didn't explain the requirements properly but interseting to see that option available too