Página 1 de 1

Example of oDataSet:SetRelation Needed

Publicado: Mié Sep 24, 2008 6:32 am
por g.s.rogers
I'm trying to create a form with two oDbfBrowse objects with the dataset in
one browse object being the parent and the dataset of the other browse
object showing child records.
In the form initialize event, I set the relationship like this:
METHOD FormInitialize( oSender ) CLASS Form_ConsolidatedPrecincts
with object ::oDbfDataSetAssignedPrecincts
:Open()
:AddIdxFile("CAVCPIEP") // IDNO+ECODE+PRCODE
:AddIdxFile("CAVCPREP") // ECODE+PRCODE
SET ORDER TO 1
end with
with object ::oDbfDataSetConNames
:Open()
:AddIdxFile("CAVCONID") // IDNO
:AddIdxFile("CAVCONEC") // ECODE+CONNAME
SET ORDER TO 2
:SetRelation("IdNo",::oDbfDataSetAssignedPrecincts)
:GoTop()
end with
::oDbfBrowseConNames:SetDBF("CAVCONSL")
::oDbfBrowseConNames:GoTop()
::oDbfBrowseAssignedPrecincts:SetDBF("CAVCONPR")
::oDbfBrowseAssignedPrecincts:GoTop()
::oDbfBrowseConNames:SetFocus()
RETURN Nil
The child browse object shows every record in the
oDbfDataSetAssignedPrecincts, rather than just child records of the active
row in the parent browse object.
What am I doing wrong?