Home > Archive > Programming with dBASE > January 2006 > Combobox and older data









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Combobox and older data
Bruce W. Mercer

2006-01-02, 8:23 pm

Hi all,

I have a combobox in dBASE PLUS 2.01 that is datalinked to one table
and then datasourced to another table. If the datasourced table does not
have a value that is in the datalinked table, it will not display that value
when
navigating through the the rowset. Like the sample in OLH. If I discontinue
a flavor and remove it from the datasource then you can't see which products
had the old flavor, before it was discontinued.

Did I explain that ok? Can this be corrected?

TIA
Bruce



Roland Wingerter

2006-01-03, 7:23 am

Bruce W. Mercer wrote

>
> I have a combobox in dBASE PLUS 2.01 that is datalinked to one table
> and then datasourced to another table. If the datasourced table does not
> have a value that is in the datalinked table, it will not display that
> value when
> navigating through the the rowset. Like the sample in OLH. If I
> discontinue
> a flavor and remove it from the datasource then you can't see which
> products
> had the old flavor, before it was discontinued.
>
> Did I explain that ok? Can this be corrected?

------
Instead of datalink and datasource you can use the field's lookupSQL
property and assign the SQL statement as needed.
The code snippet below assumes the flavor table has a logical field isValid,
and the form has two radiobuttons.

this.COMBOBOX1 = new COMBOBOX(this)
with (this.COMBOBOX1)
dataLink = form.product1.rowset.fields["flavor"]
// etc.
endwith

function RADIOBUTTON1_onChang
e
if this.value = true
form.rowset.fields["flavor"].lookupSQL := ;
"select * from flavor"
else
form.rowset.fields["flavor"].lookupSQL := ;
"select * from flavor where isValid = true"
endif
form.rowset.refreshControls()
// Restate the datalink to update combobox values
form.combobox1.datalink := ;
form.combobox1.datalink
return

You could adapt this approach so that the combobox shows all flavours in
browse mode and valid flavours only when adding a new record.

Hope this helps

Roland


Todd Kreuter

2006-01-03, 9:23 am

"Bruce W. Mercer" wrote:
>
> I have a combobox in dBASE PLUS 2.01 that is datalinked to one table
> and then datasourced to another table. If the datasourced table does not
> have a value that is in the datalinked table, it will not display that value
> when
> navigating through the the rowset.



Values will not be displayed if your lookupRowset filters out those
values or those values no longer exist. You need to constrain the
lookupRowset when creating the combobox dataSource (assuming the
lookupRowset is used to create the combobox dataSource) then remove the
constraint after the form opens.

--
Todd Kreuter [dBVIPS]
Bruce W. Mercer

2006-01-04, 8:23 pm

Todd,

The lookupRowset or datasource comes from a translation table that I need
to use. I found that if I changed the CB style to 1 then I could view the
old values
that are not in the datasource table anymore. But then had some other issues
like
removing values from the CB field, that was not a problem with style 2.

Thanks
Bruce


"Todd Kreuter" <tkreuter@dbvips.usa> wrote in message
news:43BA8191.B0FEA7B3@dbvips.usa...
> "Bruce W. Mercer" wrote:
>
>
> Values will not be displayed if your lookupRowset filters out those
> values or those values no longer exist. You need to constrain the
> lookupRowset when creating the combobox dataSource (assuming the
> lookupRowset is used to create the combobox dataSource) then remove the
> constraint after the form opens.
>
> --
> Todd Kreuter [dBVIPS]



Todd Kreuter

2006-01-05, 7:23 am

"Bruce W. Mercer" wrote:
>
> The lookupRowset or datasource comes from a translation table that I need
> to use. I found that if I changed the CB style to 1 then I could view the
> old values that are not in the datasource table anymore.


Right, I forgot there was a difference when using style 1. I use a
custom combobox which is always style 1, but can restrict selections to
what is in the list like style 2.

> But then had some other issues like removing values from the CB field,
> that was not a problem with style 2.


Take a look at comboAFS in the dUFLP. Ensure the styleDDL is true and
you should get a combobox that acts like style 2.

--
Todd Kreuter [dBVIPS]
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com