Welcome to the nuBuilder Forums!

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

Search Objects for New Records

Questions related to using nuBuilder Forte.
ajackson
Posts: 19
Joined: Fri Mar 22, 2024 4:59 pm

Search Objects for New Records

Unread post by ajackson »

Greetings,

I have a browse form which takes me to its associated edit form for a new record when I press the Add button.
On the edit form I have several select objects both of type 'Select' and 'Input: Select'.
All of these are based on select statements that work when existing records are edited but produce no results for new records and hence empty select lists.

How is this so? Am I missing something?

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

Re: Search Objects for New Records

Unread post by kev1n »

Hi,

Do you use Hash Cookies in the SQL / can you post an example of an SQL here?
ajackson
Posts: 19
Joined: Fri Mar 22, 2024 4:59 pm

Re: Search Objects for New Records

Unread post by ajackson »

Here's the SQL:

select distinct timepoint
from StudyTimepoint
where timepoint is not null
order by timepoint

No hash cookies in sight!
ajackson
Posts: 19
Joined: Fri Mar 22, 2024 4:59 pm

Re: Search Objects for New Records

Unread post by ajackson »

Are you able to replicate the problem?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Search Objects for New Records

Unread post by kev1n »

The SQL must return 2 column, not 1 (See wiki)

If the display and the bound value are identical, use

Code: Select all

select distinct timepoint, timepoint
from StudyTimepoint
where timepoint is not null
order by timepoint
ajackson
Posts: 19
Joined: Fri Mar 22, 2024 4:59 pm

Re: Search Objects for New Records

Unread post by ajackson »

Unfortunately this doesn't work either.
It must be something else as it works when editing records.
I've even stripped down the SQL statement to:

select 'test' as study, 'test' as study
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Search Objects for New Records

Unread post by kev1n »

I can't replicate the issue on my end. However, it's possible that the problem stems from another issue within the form.
Please check nuDebug Results, the server log, and the developer console for any errors.

Does the issue also occur if you create a completely new form with only one single select object on it?
ajackson
Posts: 19
Joined: Fri Mar 22, 2024 4:59 pm

Re: Search Objects for New Records

Unread post by ajackson »

I'll investigate and get back to you...
ajackson
Posts: 19
Joined: Fri Mar 22, 2024 4:59 pm

Re: Search Objects for New Records

Unread post by ajackson »

Hi Kevin,

Looking in the debug results it turns out that another sql statement in another tab had errors due to an undefined hash variable when a new record is displayed. So I've made sure that all hash variables have default values so that no errors are produced and now the list boxes are correctly populated.

In doing this however I'm finding that I'm unable to set the default value of a lookup object. I've tried the methods outlined here:
https://github.com/nuBuilder/nuBuilder- ... ault_value
but to no avail. Can default values for lookup objects be set?

Thanks for pointing me in the right direction!

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

Re: Search Objects for New Records

Unread post by kev1n »

Post Reply