Page 1 of 2
Subform lookup filter
Posted: Mon Jan 28, 2013 11:46 pm
by ruiascensao
Hi,
Is there a way to use hach variables in a subform to filter a lookup?
subform_lookup_filter.jpg
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.
Re: Subform lookup filter
Posted: Tue Jan 29, 2013 11:26 pm
by ruiascensao
Hi,
Any suggestion?
Thank you.
Re: Subform lookup filter
Posted: Thu Jan 31, 2013 7:39 am
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
Re: Subform lookup filter
Posted: Wed Feb 06, 2013 3:27 pm
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
Re: Subform lookup filter
Posted: Thu Feb 07, 2013 9:14 pm
by ruiascensao
Hi Steven,
Any suggestion?
Thank You.
Re: Subform lookup filter
Posted: Fri Feb 08, 2013 6:06 am
by admin
Rui,
Have you tried updating the 2 fields when you click into or hover over Zone and Ref?
Steven
Re: Subform lookup filter
Posted: Fri Feb 08, 2013 3:51 pm
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
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.
Re: Subform lookup filter
Posted: Sat Feb 09, 2013 12:35 am
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
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
Re: Subform lookup filter
Posted: Mon Mar 04, 2013 7:13 pm
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.
Re: Subform lookup filter
Posted: Tue Mar 05, 2013 12:06 pm
by ruiascensao
Hi Steven,
Any idea why the hidden field "warehouse" does not work as hash variable?
Thanks