the view: t_jobs

job_desc job_id
------------- ------
manager 4
clerk 5
n/a 3

I want the value of job_id (column 2) while the form will show job_desc
(column 1). The combobox is set up as follows:

controlsource=thisform.var
rowsource=t_jobs
rowsourcetype=1. alias
boundto = .t.
boundcolumn = 2

whenever I click the combobox to select a value, it always become blank.
what step did I miss?


--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
^ ^ 12:26am up 12 days, 58 min, 0 users, load average: 1.00, 1.01,
1.00

Re: combobox and bounding by toylet

toylet
Tue Feb 03 12:04:49 CST 2004

> controlsource=thisform.var
> rowsource=t_jobs
> rowsourcetype=1. alias
> boundto = .t.
> boundcolumn = 2
>
> whenever I click the combobox to select a value, it always become blank.
> what step did I miss?

Puzzling. the combobox would work normally if I change the rowsourcetype
to SQL statement. IF I use rowsourcetype=alias, the combobox will become
blank after making a selection. Is this a bug or am I missing step?

--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
^ ^ 2:02am up 12 days, 2:34, 0 users, load average: 1.70, 1.28, 1.10

Re: combobox and bounding by Trey

Trey
Tue Feb 03 12:12:38 CST 2004

note: RowSourceType of 1 is Value --- 2 is Alias

that said, it also depends on the order of the columns in the Alias - in
your combo, the first column is displayed, the 2nd is bound.
with either type 2 (Alias) or type 6 (Fields), you can specify fields - I'd
use type 6, just in case they remove the ability to specifiy fields with
type 2. to specify fields, specify the one you want displayed first, then
the bound one 2nd, e.g.

RowSourceType = 6 (Fields)
RowSource="t_jobs.displayThisField,bindThisField"
BoundTo=.T.
BoundColumn=2


"toylet" <toylet@mail.hongkong.com> wrote in message
news:ekGa0Ao6DHA.1428@TK2MSFTNGP12.phx.gbl...
> > controlsource=thisform.var
> > rowsource=t_jobs
> > rowsourcetype=1. alias
> > boundto = .t.
> > boundcolumn = 2
> >
> > whenever I click the combobox to select a value, it always become blank.
> > what step did I miss?
>
> Puzzling. the combobox would work normally if I change the rowsourcetype
> to SQL statement. IF I use rowsourcetype=alias, the combobox will become
> blank after making a selection. Is this a bug or am I missing step?
>
> --
> .~. Might, Courage, Vision. In Linux We Trust.
> / v \ http://www.linux-sxs.org
> /( _ )\ Linux 2.4.22-xfs
> ^ ^ 2:02am up 12 days, 2:34, 0 users, load average: 1.70, 1.28, 1.10



Re: combobox and bounding by toylet

toylet
Tue Feb 03 12:27:52 CST 2004

> type 2. to specify fields, specify the one you want displayed first, then
> the bound one 2nd, e.g.
>
> RowSourceType = 6 (Fields)
> RowSource="t_jobs.displayThisField,bindThisField"
> BoundTo=.T.
> BoundColumn=2

Tried, but the DisplayThisField still go blank after making a selection
in the combobox. Really weird. The behaviour was not observeed if I use
RowSourceType=SQL Statement (where statement is just "select
displayfield, bindfield from t_jobs"). I suspected that it's either a
bug or a feature. BTW, I am using Visual Foxpro 6.0 SP5.

I believe I am following the right steps...

--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
^ ^ 2:24am up 12 days, 2:56, 0 users, load average: 1.00, 1.00, 1.00

Re: combobox and bounding by David

David
Tue Feb 03 19:34:43 CST 2004

toylet,

combo boxes are MUCH easier to use and better behaved if your RowSource them
to an array property of the cbo itself. You can easily add an array property
to your lowest level cbo class. You can run a SQL statement to select into
the array like this from the Init

* cbo.Init()
dodefault()
return ( this.GetArray() )

* cbo.GetArray()
with this
if ( lower( .RowSource ) == "this.macode" )
.SQL()
.Requery()
endif
endwith

* cbo.SQL()
* abstract method

The subclasses then just have to fill in the SQL method like in your case

select job_desc, job_id ;
from t_jobs ;
into array this.maCode ;
order by 1


--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro

"toylet" <toylet@mail.hongkong.com> wrote in message
news:e4%239jNn6DHA.1072@TK2MSFTNGP11.phx.gbl...
> the view: t_jobs
>
> job_desc job_id
> ------------- ------
> manager 4
> clerk 5
> n/a 3
>
> I want the value of job_id (column 2) while the form will show job_desc
> (column 1). The combobox is set up as follows:
>
> controlsource=thisform.var
> rowsource=t_jobs
> rowsourcetype=1. alias
> boundto = .t.
> boundcolumn = 2
>
> whenever I click the combobox to select a value, it always become blank.
> what step did I miss?