Página 1 de 1

dataset:save() problem?

Publicado: Lun Ene 12, 2009 2:00 am
por g.s.rogers
I use the following code to update a child browse object based upon the
current record in a parent browse object:
METHOD DBBrowseFeeGroupsChange( oSender, lBookMarkChanged ) CLASS
Form_FeeGroups
LOCAL nTotal := 0
LOCAl cSeekVal
LOCAL nRec
// refresh child browse object if record position in Parent changed
if lBookMarkChanged
::oDbfDataSetFeeGroups:Refresh()
cSeekVal := ::oDbfDataSetFeeGroups:Allocid
// scope of child dataset is determined by Allocid of parent dataset
// Parameters are (xTop,xBottom,lGoFirst,lRefresh)
::oDbfDataSetGroupAllocations:SetScope( cSeekVal, cSeekVal, .T., .T. )
::oLabelGroupAllocations:cText := "Allocations for " +
Substr(::oDBEditDescrip:Value,1,20)
// calculate dynamic total
if ::oDbfDataSetGroupAllocations:Seek( cSeekVal )
do while ::oDbfDataSetGroupAllocations:Allocid == cSeekVal .and. !
::oDbfDataSetGroupAllocations:Eof()
nTotal := nTotal + ::oDbfDataSetGroupAllocations:Amount
::oDbfDataSetGroupAllocations:Skip()
enddo
endif
::oMaskEditTotal:Value := nTotal
::oDbfDataSetGroupAllocations:GoTop()
::oDBBrowseGroupAllocations:ReFresh(.T.)
endif
RETURN Nil
This works fine until I edit a parent record and use
::oDbfDataSetFeeGroups:Save(), then it appears that ::oDBfDataSetFeeGroups
stays on the record edited and the TDBBrowse table corresponding to that
dataset is no longer linked. After a Save(), I can move to different records
in the parent browse object and the ::oDbfDataSetFeeGroups:Allocid stays the
same, therefore the child browse object does not change from whatever it was
when the parent record was saved. If I cancel the edit, rather than saving,
the parent and child stay sychronized, so it something about the Save() that
is affecting the coordination between the parent browse object and the
parent dataset.
Can you tell me what I need to do to fix this?
Thanks in advance,
Gary Rogers