Page 1 of 1

Select object returning undefined

Posted: Fri Mar 09, 2018 11:35 am
by tonyd
I am at a loss as to how my Select Object dropdown list returns only a list of "undefined" selections. I used the SQL Builder
sqlbuilder.jpg
which gave me this SQL statement
sql.jpg
But then I get this
undefined.jpg
BTW, the form and table for this Select Object were created manually. Any ideas?

Re: Select object returning undefined

Posted: Fri Mar 09, 2018 12:50 pm
by toms
Quoting the wiki:
SQL or List
The resulting list for this Object can be created 1 of 2 ways.

SQL - A valid SQL query that returns 2 columns - If you want any help building SQL, the SQL Button will direct you to nuBuilder's SQL Builder.
List - A list delimited by a | eg. 0|No|1|Yes
In other words, you need to include practive_types_id in your query.

Re: Select object returning undefined

Posted: Fri Mar 09, 2018 3:00 pm
by tonyd
Of course, it sounds so logical when you say it. :D

After adding the id column I get the proper list in the dropdown, but it won't save or restore the value.

Edit: The value getting returned is "null".

Re: Select object returning undefined

Posted: Fri Mar 09, 2018 11:22 pm
by admin
TonyD,

Is your query something like this?

Code: Select all

SELECT
    practice_id,             ##-- hidden value that will be saved.
    practice_types_types     ##-- value that will be chosen by the user
FROM practice_types
ORDER BY practice_types_types
Steven

Re: Select object returning undefined

Posted: Sat Mar 10, 2018 5:20 am
by tonyd
yes

Re: Select object returning undefined

Posted: Sat Mar 10, 2018 5:43 am
by admin
TonyD,

OK, then I have no idea why it isn't working for you.

Have you tried copying an Object that works and seeing what the difference is?

That's what I would do.

Steven

Re: Select object returning undefined

Posted: Sat Mar 10, 2018 11:37 am
by tonyd
Unfortunately, the only other Select objects use a simple ordered list and not SQL. I manually created the table that the Select relies on, but that shouldn't matter.

I think I will try creating the table again using Fast Forms this time and see if that changes anything.

EDIT: After creating a new Select object by first creating a new table and form using FastForms, everything works just fine. I have no idea why it would not work for a manually created form/table, but, at this point, I have wasted enough time.

Re: Select object returning undefined

Posted: Sat Mar 10, 2018 6:00 pm
by admin
.