Welcome to the nuBuilder Forums!

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

Lookup on data in subforms

Questions related to using nuBuilder Forte.
Post Reply
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

Lookup on data in subforms

Unread post by yvesf »

Hello,

Is there a mean to retrieve data from a subform via a lookup field ?
Ex :
I have a company table in which I have a subform employee with firstname, lastname.
I have another table project in which I would like to lookup on employee whatever the company is.
On project table, I create a field project name, and a subform field stakeholders.
The stakeholder subform has a lookup on subform employee. I have got nothing as result of the lookup.
Is it possible to do that, it seems you cannot do that when you use subform mechanism.
Is anyone could confirm that ? is there any workaround ?
Thx and regards,

Yves
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

Re: Lookup on data in subforms

Unread post by yvesf »

Solved by Kevin. You need to have the browse subform configured exactly for that reason.
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

Re: Lookup on data in subforms

Unread post by yvesf »

Hello,

How to cascade lookup fields on edit forms and on subforms (mode grid) ?
Cascading select fields on edit form could be done by passing the first field value (company drop down field value ) in the clause where of the second field (employee dropdown field value).You need also to refresh the send select onchange event of the first select field custom tab.
How to perform that on subforms ? with select fields ? and with lookup fields ?
Lookup fields are interesting because of their search ability and are very interesting when dropdown list cannot be implemented due to number of records.
Let me take my example again.
I have got the list of companies that contains 100 + records. Having a such huge list in dropdown list is weird. In the second dropdownlist, same thing : it's the employee's of each company which has 100 + records for most of them. Having lookup fields would be the option.
How to perform that on edit form and on subforms mode grid ?
Many thanks for your help.


Yves
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Lookup on data in subforms

Unread post by kev1n »

Basically, a lookup form can be filtered by setting a hash cookie before it's opened.

E.g. in JS:

Code: Select all

nuSetProperty('your_filter', '123');
in the Browse SQL:

Code: Select all

WHERE a_column = '#your_filter#'
selector
Posts: 41
Joined: Tue Feb 22, 2022 1:55 pm
Has thanked: 9 times

Re: Lookup on data in subforms

Unread post by selector »

kev1n wrote: Wed Jan 11, 2023 9:01 am Basically, a lookup form can be filtered by setting a hash cookie before it's opened.
hey Kevin. But it is also necessary to do this in the onchange event. The problem is that the onchange event is triggered only after saving the form. At least if we talk about Lookup fields.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Lookup on data in subforms

Unread post by kev1n »

Can't you trap the lookup's onclick event and set the Hash Cookie there?

Required nu-version:
Files Version: V.4.5-2023.03.10.03
selector
Posts: 41
Joined: Tue Feb 22, 2022 1:55 pm
Has thanked: 9 times

Re: Lookup on data in subforms

Unread post by selector »

kev1n wrote: Tue Mar 28, 2023 3:16 pm Can't you trap the lookup's onclick event and set the Hash Cookie there?

Required nu-version:
Files Version: V.4.5-2023.03.10.03
My bad onchange isnt triggered at all.
tried this. Onclick triggered only before value is changed. While i need to obtain new value before saving form.
selector
Posts: 41
Joined: Tue Feb 22, 2022 1:55 pm
Has thanked: 9 times

Re: Lookup on data in subforms

Unread post by selector »

as a little workaround i tried to add

Code: Select all

$('#' + id + 'code').trigger('input');
in

Code: Select all

function nuGetLookupId(pk, id, setFocus, setEdited) 
There is a feeling that this is not right solution, but it works. I will be glad to hear an edit of this decision, which will be correct.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Lookup on data in subforms

Unread post by kev1n »

I believe I haven't yet grasped the complete context of your objectives. Kindly provide a comprehensive, step-by-step explanation that includes the data entry process, the objects involved, the rationale for triggering the onchange event, the sequence of control interactions, and any other pertinent details. This will enable me to gain a clearer understanding of your goals and assist in devising the most suitable solution. Additionally, a screen recording demonstrating the process would be highly beneficial as well.
Post Reply