Page 1 of 1

Filter Records for a Lookup

Posted: Thu Oct 12, 2023 6:27 pm
by saultpastor
I have an invoice form. There is a lookup for the customer, and a lookup for the customer's vehicle. One customer may have many vehicles. I have used nuSetProperty with an onclick event that passes a hash cookie to the lookup form and filters using a WHERE statement. I can make it work by manually putting in the actual customer_id record but I cannot get the syntax right to pull the customer_id record from the database. It seems this method only works for a fixed value and not a relational value?

Craig

Re: Filter Records for a Lookup

Posted: Fri Oct 13, 2023 7:02 am
by kev1n
Hi Craig

Use the onfocus event instead of onclick event to set the Hash Cookie.

Re: Filter Records for a Lookup

Posted: Fri Oct 13, 2023 4:41 pm
by saultpastor
Kevin,
I'm sorry to bother you with this. I must be thick...

This is what I am putting on the vehicle lookup object custom code (or should this be on the customer lookup?)
custom code on lookup object.PNG
This is what shows up in the form info but only after I click on the text box for the lookup object. Clicking the magnifying glass on the object doesn't change it.
nuSetProperty().PNG
This is the code in the lookup browse form
browse form for lookup.PNG
Thanks
Craig

Re: Filter Records for a Lookup

Posted: Fri Oct 13, 2023 4:50 pm
by kev1n
saultpastor wrote: Fri Oct 13, 2023 4:41 pm or should this be on the customer lookup
You could give it a try..

Re: Filter Records for a Lookup

Posted: Sat Oct 14, 2023 2:01 am
by saultpastor
I have tried the customer lookup before And just tried it again. Didn't work. I would expect it would pass the actual PK for the customer but the form info>--properties shows it setting the property to "customer_id" not the PK for that particular customer. Is this the normal behavior, and is this the proper way to accomplish filtering the lookup?

Re: Filter Records for a Lookup

Posted: Tue Oct 17, 2023 5:42 pm
by kev1n
By setting nuSetProperty('customer', 'customer_id'), the string customer_id is set as Hash Cookie and not the actual value.
Is customer_id a field on your form? then try nuSetProperty('customer', customer_id.vaue) instead