Reduce Lookup results

Questions related to using nuBuilder Forte.

Reduce Lookup results

Postby vanman » Tue Nov 13, 2018 10:55 pm

Hi

If I want to use a Lookup object and have the results reduce to show a subset. Is the only way to have different forms with WHERE clauses in the Browse screen?

I have categorys table that category_id, cat_code, cat_name, cat_attribute_id

cat_attribute_id is the parent category in the attribute table and the category stores category and sub category,
att_name from (cat_attribute_id) cat_name is like.

Project Management - Project Manager
Project Management - Contracts
Construction - Drainage
Construction - General
Payment Type - Debit
Payment Type - Refund
Project Financial - Variation
Project Financial - Initial Budget

When I want a lookup for payment type I only want to browse through those with a category of Payment Type.

Thanks for your assistance.

Paul
vanman
 
Posts: 8
Joined: Fri Mar 02, 2018 7:39 am

Re: Reduce Lookup results

Postby admin » Wed Nov 14, 2018 7:05 am

Paul,

You can use a Hash Cookie in the SQL of the Form to filter what you need.

pvg2.PNG
pvg2.PNG (20.16 KiB) Viewed 767 times


And you can set that value (hide) to a value before opening the Browse Form.

pvg1.PNG
pvg1.PNG (18.34 KiB) Viewed 767 times



Steven
admin
Site Admin
 
Posts: 3226
Joined: Mon Jun 15, 2009 9:53 am

Re: Reduce Lookup results

Postby vanman » Wed Nov 14, 2018 10:31 am

Thanks Mate
vanman
 
Posts: 8
Joined: Fri Mar 02, 2018 7:39 am

Re: Reduce Lookup results

Postby admin » Wed Nov 14, 2018 10:45 am

.
admin
Site Admin
 
Posts: 3226
Joined: Mon Jun 15, 2009 9:53 am

Re: Reduce Lookup results

Postby joecocs » Fri Jan 24, 2020 3:36 am

Hello,
I'm looking to filter on a 'lookup' and try your method with the hash code.

For this to work I have to reverse the elements of the code?!?

But I still manage to assign a value to my text box.

Is it possible to assign the value of a Lookup to my text area?

Thank's for your help.
joecocs
 
Posts: 59
Joined: Wed Jul 04, 2018 11:41 pm
Location: France

Re: Reduce Lookup results

Postby kev1n » Fri Jan 24, 2020 2:58 pm

joecocs wrote:For this to work I have to reverse the elements of the code?!?


What do you mean by that?

I would set the hash cookie with nuSetProperty()
eg.

Code: Select all
nuSetProperty("color","red")
;

Then use the hash cookie #color# in your SQL.


The lookup object has a PHP After Browse event. This runs after a lookup value is chosen.
Use nuSetFormValue() to set the value of your text area.

https://wiki.nubuilder.net/nubuilderfor ... tFormValue
kev1n
 
Posts: 528
Joined: Mon Oct 15, 2018 2:13 am

Re: Reduce Lookup results

Postby joecocs » Fri Jan 24, 2020 7:50 pm

Thank you,
The lookup object has a PHP After Browse event. This runs after a lookup value is chosen.
Use nuSetFormValue() to set the value of your text area.

https://wiki.nubuilder.net/nubuilderfor ... tFormValue


I understand the principle, I got a little lost.

My need is to retrieve the value from my 'lookup 1' and assign the value in a 'text area' which is in a sForm (run) object,

but I can't assign the value to this 'text area'.
joecocs
 
Posts: 59
Joined: Wed Jul 04, 2018 11:41 pm
Location: France

Re: Reduce Lookup results

Postby kev1n » Fri Jan 24, 2020 8:39 pm

In After Browse:

Code: Select all
$lu = nuLookupRecord();

nuSetFormValue('your_text_area', $lu->your_value);



-> Replace your_text_area with the Object ID of your text area

-> Replace your_value with the field name of the lookup table
kev1n
 
Posts: 528
Joined: Mon Oct 15, 2018 2:13 am

Re: Reduce Lookup results

Postby joecocs » Sun Jan 26, 2020 2:21 am

Thank you for your answer,

I tested but I couldn't because I had a relationship problem in my database. :roll:
I redid my base but I can't filter an iframe (run) from a cell of another iframe (run) :oops:

i explain: :geek:
In Form1-Tab1 i've an iframe1 (run) with recordsets (Tiers) in Browse & edit.
In Form1-Tab2 I've an iFrame2 (run) with recordsets (Contacts) in Browse & edit.
I would like to filter the iFrame2 with the Tiers_Id field contained in the iFrame1. :?:

I looked in the wiki and and in your answer to understand but I can't. :oops:
if you have an idea i would be happy to help. :idea:
joecocs
 
Posts: 59
Joined: Wed Jul 04, 2018 11:41 pm
Location: France

Re: Reduce Lookup results

Postby admin » Sun Jan 26, 2020 7:46 am

joecocs,

Can you post a screengrab of your main Edit Form?


Steven
admin
Site Admin
 
Posts: 3226
Joined: Mon Jun 15, 2009 9:53 am

Next

Return to General