Welcome to the nuBuilder Forums!

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

Reduce Lookup results

Questions related to using nuBuilder Forte.
vanman
Posts: 54
Joined: Thu Mar 01, 2018 11:09 pm
Has thanked: 1 time

Reduce Lookup results

Unread post by vanman »

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
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Reduce Lookup results

Unread post by admin »

Paul,

You can use a Hash Cookie in the SQL of the Form to filter what you need.
pvg2.PNG
And you can set that value (hide) to a value before opening the Browse Form.
pvg1.PNG

Steven
You do not have the required permissions to view the files attached to this post.
vanman
Posts: 54
Joined: Thu Mar 01, 2018 11:09 pm
Has thanked: 1 time

Re: Reduce Lookup results

Unread post by vanman »

Thanks Mate
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Reduce Lookup results

Unread post by admin »

.
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: Reduce Lookup results

Unread post by joecocs »

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

Re: Reduce Lookup results

Unread post by kev1n »

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.cloud/ ... tFormValue
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: Reduce Lookup results

Unread post by joecocs »

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.cloud/ ... 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'.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: Reduce Lookup results

Unread post by kev1n »

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
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: Reduce Lookup results

Unread post by joecocs »

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:
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Reduce Lookup results

Unread post by admin »

joecocs,

Can you post a screengrab of your main Edit Form?


Steven
Post Reply