In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

dataset:save() problem?

Xailer professional forum in English
g.s.rogers
Mensajes: 202
Registrado: Dom Feb 17, 2008 3:35 am

dataset:save() problem?

Mensaje 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
Responder