Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Subform lookup filter

ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Subform lookup filter

Unread post by ruiascensao »

Hi,

Is there a way to use hach variables in a subform to filter a lookup?
subform_lookup_filter.jpg
subform_lookup_filter.jpg (26.12 KiB) Viewed 11901 times
In the subform I need to select the "Warehouse" (first lookup) then a "zone" within the selected warehouse a then a "Zone Ref." from the selected zone.

Thank you.
BR
Rui
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Subform lookup filter

Unread post by ruiascensao »

Hi,

Any suggestion?

Thank you.
BR
Rui
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Subform lookup filter

Unread post by admin »

Rui,

You can filter lookups on fields from the main Form.

So if you put 2 hidden fields on the main Form and update them with the warehouse and zone from the same row anytime you "onfocus" zone or ref, zone and ref should filter out properly.

Here is a video on filtering a lookup..

http://www.youtube.com/watch?v=-XhDsNxVfDc

Steven
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Subform lookup filter

Unread post by ruiascensao »

Hi Steven,

Thank you for your reply.

I only have a problem:
The function to update the hidden fields is called from "onfocus" . If I clique on the button of the lookup form it does not work. It only works if I clique on the code area.

Any solution for this.

Thank you again for your support.

BR
Rui
BR
Rui
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Subform lookup filter

Unread post by ruiascensao »

Hi Steven,

Any suggestion?

Thank You.
BR
Rui
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Subform lookup filter

Unread post by admin »

Rui,

Have you tried updating the 2 fields when you click into or hover over Zone and Ref?

Steven
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Subform lookup filter

Unread post by ruiascensao »

Hi Steven,
I'm trying one field at the time.
I have the function:

Code: Select all

function whZone(){

   document.getElementById('hidden_wh_id').value = document.getElementById(nuGetRow()+'good_wh').value;
   idvalue = document.getElementById('hidden_wh_id').value;
}
zones.jpg
zones.jpg (25.89 KiB) Viewed 11832 times
But 'hidden_wh_id' is only updated when I click on the "code area". When I use the lookup button, it does not update the 'hidden_wh_id'.

Any suggestion?

Thank you.
BR
Rui
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Subform lookup filter

Unread post by admin »

Rui,

Try something like this..

Code: Select all

$(document).ready(function () {

    $("input[id$='jsi_product_id']").hover(
        function () {
            alert(this.id);
	}
    );
});

Capture1.PNG
Capture1.PNG (28.38 KiB) Viewed 11826 times

Obviously don't use jsi_product_id - or alert()

and do the same thing for every object you need to.

(jquery is pretty cool!)
http://www.w3schools.com/jquery/jquery_ ... ectors.asp
So is http://www.w3schools.com

Steven
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Subform lookup filter

Unread post by ruiascensao »

Hi Steven,

Thank you.
I'm still facing one issue with the hash Variables in the subform. As you advised I have done the following:
- One the main form I have a hidden field "warehouse";
- Everytime I'm on focus in the Zone field (subform) it updates the "warehouse" field (Main Form) from the same row.

Until here everything is fine.
When I try to filter the lookup field in the subform using

Code: Select all

 SELECT FROM ....... WHERE wh_id='#wharehouse#' 

it does not list anything.

But if I use

Code: Select all

 SELECT FROM ....... WHERE wh_id='#subform_wh0000warehouse#' 

...it works.
This means if I use a field from the subform as has variable it works but if I use the hidden field from the main foprm it does not.

Could you please advise about this issue.

Thank you.
BR
Rui
ruiascensao
Posts: 177
Joined: Tue Nov 15, 2011 2:24 pm

Re: Subform lookup filter

Unread post by ruiascensao »

Hi Steven,

Any idea why the hidden field "warehouse" does not work as hash variable?


Thanks
BR
Rui
Post Reply