Sorry, maybe a stupid question.
I have a lookup object on my form and others text object populated when I insert a new record.
If I change the lookup value, the text fields change correctly.
But no value is displayed in text fields if I open the edit form on an existing record: maybe I have to put some js in the JavaScript field of lookup object to work? Doesn't nuBuilder do it by default?
Thanks.
Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
lookup object don't display other fields
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact:
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: lookup object don't display other fields
massiws,
Fields other than the lookup code and lookup description will be populated only when the lookup value changes. Other fields that get populated at this time need to be saved to a field of the same name on that record. Just the same as any other Text Object.
I hope this answers you question
Steven
Fields other than the lookup code and lookup description will be populated only when the lookup value changes. Other fields that get populated at this time need to be saved to a field of the same name on that record. Just the same as any other Text Object.
I hope this answers you question
Steven
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact:
Re: lookup object don't display other fields
I thought the fields specified in "Update Other Fields" section in the lookup tab where populated at the same time of code and description of lookup object.
I will try to find a way to do it with javascript.
Thanks.
I will try to find a way to do it with javascript.
Thanks.
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: lookup object don't display other fields
massiws,
The best way to do what you want is by using a Display Object.
http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs
Theree is a bit more info 4:43 minutes into this tutorial http://www.youtube.com/watch?v=op-IM5hTgU0
When you select a record from the Lookup it can populate things the way you want them, but when you return to the record it will be populated by an sql select statement.
Steven
The best way to do what you want is by using a Display Object.
http://wiki.nubuilder.com/tiki-index.ph ... uilderDocs
Theree is a bit more info 4:43 minutes into this tutorial http://www.youtube.com/watch?v=op-IM5hTgU0
When you select a record from the Lookup it can populate things the way you want them, but when you return to the record it will be populated by an sql select statement.
Steven
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact:
Re: lookup object don't display other fields
admin,
sorry, I'm embarrassed, but I wasn't able to use a display object!
I several times read the wiki and listen the tutorial, but this don't explain so much (maybe I don't understand).
My sql is:
I want to display on the form the cli_address value from client table.
In the "Field Name" field on the All tab I put "cliAdr", to populate the field with the lookup object, and this work perfectly.
In the "SQL to display" field in the Display tab I put this:
but this return nothing.
In debug I can see that the HashVariable #rep_cli_id# is present with the right value.
Perhaps can the display objects return only values stored in the main table (in this case repair table)?
Sure I forget something, but I can not understand what!
Any suggestion will be apreciated!
sorry, I'm embarrassed, but I wasn't able to use a display object!
I several times read the wiki and listen the tutorial, but this don't explain so much (maybe I don't understand).
My sql is:
Code: Select all
SELECT * FROM repair AS r
INNER JOIN (
client AS c, atype AS t, brand AS b, repair_status AS rs
) ON (
r.rep_cli_id = c.cli_id AND
r.rep_typ_id = t.typ_id AND
r.rep_bra_id = b.bra_id AND
r.rep_rst_id = rs.rst_id
)
LEFT JOIN (supplier as s) ON (r.rep_sup_id = s.sup_id)
ORDER BY r.rep_number DESC
In the "Field Name" field on the All tab I put "cliAdr", to populate the field with the lookup object, and this work perfectly.
In the "SQL to display" field in the Display tab I put this:
Code: Select all
SELECT cli_address FROM client WHERE cli_id = '#rep_cli_id#'
In debug I can see that the HashVariable #rep_cli_id# is present with the right value.
Perhaps can the display objects return only values stored in the main table (in this case repair table)?
Sure I forget something, but I can not understand what!
Any suggestion will be apreciated!
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: lookup object don't display other fields
massiws,
I have rewritten part of the Wiki on Display Objects. Hopefully it explains things better now.
http://wiki.nubuilder.com/tiki-index.ph ... isplay+Tab
It sounds like you are trying to fill in fields on the Display Tab when you are making a Lookup Object.
The Display Tab is only used for Display Objects.
To achieve what you want you will need 1 Lookup Objects and a number of Display Objects.
Steven
I have rewritten part of the Wiki on Display Objects. Hopefully it explains things better now.
http://wiki.nubuilder.com/tiki-index.ph ... isplay+Tab
It sounds like you are trying to fill in fields on the Display Tab when you are making a Lookup Object.
The Display Tab is only used for Display Objects.
To achieve what you want you will need 1 Lookup Objects and a number of Display Objects.
Steven
-
- Posts: 503
- Joined: Thu May 24, 2012 2:08 am
- Location: Milan, Italy
- Contact:
Re: lookup object don't display other fields
I found my bug!!
As I said in a previous post, when I insert a new record I want to select a customer with a lookup object and populate other fields (address, phone, etc.). Also I want to display these fields when I show an existing record on edit form.
Your suggestion to use a lookup object for the customer select and display objects for the other fields was correct.
My error was in the HashVariable in the SQL sentence of the display object. This don't work:
I have rewritten the SQL sentence in the display object:
I think my mistake was considering the #rep_cli_id# HashVariable: only #id# work fine; if I understand well, the #id# HashVariable is ALWAYS referred to the primary table that retrive the data to edit, in my case repair table.
The wiki is more comprehensible now!
However, all's well what ends well!
Thanks Steven.
As I said in a previous post, when I insert a new record I want to select a customer with a lookup object and populate other fields (address, phone, etc.). Also I want to display these fields when I show an existing record on edit form.
Your suggestion to use a lookup object for the customer select and display objects for the other fields was correct.
My error was in the HashVariable in the SQL sentence of the display object. This don't work:
Code: Select all
SELECT cli_address FROM client WHERE cli_id = '#rep_cli_id#'
Code: Select all
SELECT cli_address FROM client INNER JOIN repair ON cli_id = rep_cli_id WHERE rep_id = '#id#'
The wiki is more comprehensible now!
However, all's well what ends well!
Thanks Steven.
-
- Site Admin
- Posts: 2781
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
- Been thanked: 1 time
Re: lookup object don't display other fields
massiws,
Well done, with the help of sql a Display Object can be very powerful.
Steven
Well done, with the help of sql a Display Object can be very powerful.
Steven