Discussion:
Combobox datasource
(too old to reply)
Ken Mayer [dBVIPS]
2008-12-08 05:29:12 UTC
Permalink
I set up a form with a combobox that is not datalinked, but has a field as the datasource. The datasource field is a calculated field. When the form opens, the combobox has the field value of the first record in the field’s table. However, when I drop down a list, the list is empty for the combobox.
The calculated field puts together the last, first fields, and the table is indexed on a cmobined index of 2 fields - last, first.
Is it possible to use a calculated field for a combobox datasource?
Not as such. The problem is that a calculated field is a virtual field
-- it doesn't actually exist until the record has focus.

You may want to add a routine that creates an array, and populates it
from the calculated field ... then use the array as the dataSource for
the combobox.

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Mark
2008-12-08 15:47:09 UTC
Permalink
Ken,

Ah, I see. I know I ran into this before with calculated fields.

This time I switched to using sql to create the field using:
LAST || ', ' || FIRST as FULL_NAME
Then used that as the datasource field and all seems to work now.

Thanks Ken,
Mark
Post by Ken Mayer [dBVIPS]
I set up a form with a combobox that is not datalinked, but has a field as the datasource. The datasource field is a calculated field. When the form opens, the combobox has the field value of the first record in the field’s table. However, when I drop down a list, the list is empty for the combobox.
The calculated field puts together the last, first fields, and the table is indexed on a cmobined index of 2 fields - last, first.
Is it possible to use a calculated field for a combobox datasource?
Not as such. The problem is that a calculated field is a virtual field
-- it doesn't actually exist until the record has focus.
You may want to add a routine that creates an array, and populates it
from the calculated field ... then use the array as the dataSource for
the combobox.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Ken Mayer [dBVIPS]
2008-12-08 22:34:39 UTC
Permalink
Post by Mark
Ken,
Ah, I see. I know I ran into this before with calculated fields.
LAST || ', ' || FIRST as FULL_NAME
Then used that as the datasource field and all seems to work now.
Well, yeah, okay ... if you're gonna use a SQL calculated field ... <g>

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Jan Hoelterling
2008-12-09 16:59:32 UTC
Permalink
Warning - that way you end up with a "read only" table for whereever the
data source is from. May not be an issue, but something to keep in mind.

Jan

Loading...