Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Filter Records for a Lookup

Questions related to using nuBuilder Forte.
Post Reply
saultpastor
Posts: 42
Joined: Sat Jul 18, 2015 8:04 pm
Has thanked: 3 times

Filter Records for a Lookup

Unread post 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
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Filter Records for a Lookup

Unread post by kev1n »

Hi Craig

Use the onfocus event instead of onclick event to set the Hash Cookie.
saultpastor
Posts: 42
Joined: Sat Jul 18, 2015 8:04 pm
Has thanked: 3 times

Re: Filter Records for a Lookup

Unread post 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
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Filter Records for a Lookup

Unread post 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..
saultpastor
Posts: 42
Joined: Sat Jul 18, 2015 8:04 pm
Has thanked: 3 times

Re: Filter Records for a Lookup

Unread post 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?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Filter Records for a Lookup

Unread post 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
Post Reply