Page 1 of 3

Reduce Lookup results

Posted: Tue Nov 13, 2018 2:25 pm
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

Re: Reduce Lookup results

Posted: Tue Nov 13, 2018 10:35 pm
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

Re: Reduce Lookup results

Posted: Wed Nov 14, 2018 2:01 am
by vanman
Thanks Mate

Re: Reduce Lookup results

Posted: Wed Nov 14, 2018 2:15 am
by admin
.

Re: Reduce Lookup results

Posted: Thu Jan 23, 2020 7:06 pm
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.

Re: Reduce Lookup results

Posted: Fri Jan 24, 2020 6:28 am
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

Re: Reduce Lookup results

Posted: Fri Jan 24, 2020 11:20 am
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'.

Re: Reduce Lookup results

Posted: Fri Jan 24, 2020 12:09 pm
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

Re: Reduce Lookup results

Posted: Sat Jan 25, 2020 5:51 pm
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:

Re: Reduce Lookup results

Posted: Sat Jan 25, 2020 11:16 pm
by admin
joecocs,

Can you post a screengrab of your main Edit Form?


Steven