|
Home > Archive > dBASE Questions and Answers > February 2006 > Comboboxes and parent-child related tables
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 |
Comboboxes and parent-child related tables
|
|
| Pieter van Heerden 2006-02-25, 9:47 am |
| Three comboboxes need to be placed on a form. The datasources are fields from parent-child-grandchild related tables. The data for selection shown in comboboxes two and three need to be limited to that which is linked to the value selected in combobox
one.
In the case of the first two comboboxes, the actual values have to be entered into the associated table, as indexing on these values take place. In the third combobox the idnumber should be placed (typical data morphing situation).
I have tried with the tables linked and not linked. When linked, one sees duplicate entries in the first combobox, but the datasource for comboboxes two and three are not limited to that linked to the values selected in combobox one.
Therefore, the obvious answer seems to be to apply filters to the datasources for comboboxes two and three, but I can't get that right. (I must be doing something stupid along the somewhere!)
I have tried to pick up the recordid of the choice (onChange event) in the first combobox to use as filter for the next combobox datasource with:
this.datalink.parent["cropid"].value
but it does not work. I do not get the linked recordid, the recordid produced seems to be what could be the last record in the table, except that there is no record with such a number in the table.
Please advise, and at the same time thanks to all who respond.
| |
| Jan Hoelterling 2006-02-25, 9:47 am |
| Hi Pieter,
first of all, I am assuming that you are using lookupsql? With LookupSQL,
there is another rowset underneath the field.
So, let's assume you have
form.somequery.rowset.fields["cropid"].lookupsql = "select code,descript
from Sometable.dbf"
then, as you found out, "value" will give you the morphed value.
But, you now also have:
form.somequery.rowset.fields["cropid"].lookuprowset.fields["code"].value
(which will be the "raw" value)
and
form.somequery.rowset.fields["cropid"].lookuprowset.fields["descript"].value
(which is the "translated" value)
To filter that rowset, do the following:
form.somequery.rowset.fields["cropid"].lookuprowset.filter = "code =
'whatever' "
Please remember, for a LookupRowset dbase uses the first two fields - but
you can have more! So, you could assign the LookupSQL like this:
form.somequery.rowset.fields["cropid"].lookupsql = "select code,
descript, groupID from Sometable.dbf"
and filter
form.somequery.rowset.fields["cropid"].lookuprowset.filter = "GroupID =
'whatever' "
Just make sure that your first two columns are the code and the translated
value...
Hope this helps,
Jan
|
|
|
|
|