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.
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.
Sample in DBFData2
-
- Mensajes: 257
- Registrado: Mié Jul 19, 2006 8:48 am
Sample in DBFData2
1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
in the captured fashion ? Is there a way to correct it ?
2. When I start two instants of this application and attempt to update
the same record, there seem to have no check in the content of the
record prior to the update(). The 2nd update will wipe out all changes
from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
not check the content of the record. What should be the proper way to
implement a Rlock() ? savetoarray.. ?
Thanks.
David
--
in the captured fashion ? Is there a way to correct it ?
2. When I start two instants of this application and attempt to update
the same record, there seem to have no check in the content of the
record prior to the update(). The 2nd update will wipe out all changes
from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
not check the content of the record. What should be the proper way to
implement a Rlock() ? savetoarray.. ?
Thanks.
David
--
- ignacio
- Site Admin
- Mensajes: 9441
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Sample in DBFData2
David,
1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
> in the captured fashion ? Is there a way to correct it ?
Is just a bug on the demo that is already fixed. Just change the following:
STATIC FUNCTION FirstLast( oDataField )
LOCAL cText
WITH OBJECT oDataField:oDataSet
cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
END WITH
RETURN cText
> 2. When I start two instants of this application and attempt to update
> the same record, there seem to have no check in the content of the
> record prior to the update(). The 2nd update will wipe out all changes
> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
> not check the content of the record. What should be the proper way to
> implement a Rlock() ? savetoarray.. ?
You can lock the record with oDataset:Edit( .T. ) or save its content with
oDataSet:GetRecord() and check if something has changed before doing the
Update().
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"david fung" <davfung@yahoo.com> escribió en el mensaje
news:[email=45138b20@news.xailer.com...]45138b20@news.xailer.com...[/email]
> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
> in the captured fashion ? Is there a way to correct it ?
>
> 2. When I start two instants of this application and attempt to update
> the same record, there seem to have no check in the content of the
> record prior to the update(). The 2nd update will wipe out all changes
> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
> not check the content of the record. What should be the proper way to
> implement a Rlock() ? savetoarray.. ?
>
> Thanks.
> David
>
>
>
>
1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
> in the captured fashion ? Is there a way to correct it ?
Is just a bug on the demo that is already fixed. Just change the following:
STATIC FUNCTION FirstLast( oDataField )
LOCAL cText
WITH OBJECT oDataField:oDataSet
cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
END WITH
RETURN cText
> 2. When I start two instants of this application and attempt to update
> the same record, there seem to have no check in the content of the
> record prior to the update(). The 2nd update will wipe out all changes
> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
> not check the content of the record. What should be the proper way to
> implement a Rlock() ? savetoarray.. ?
You can lock the record with oDataset:Edit( .T. ) or save its content with
oDataSet:GetRecord() and check if something has changed before doing the
Update().
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"david fung" <davfung@yahoo.com> escribió en el mensaje
news:[email=45138b20@news.xailer.com...]45138b20@news.xailer.com...[/email]
> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
> in the captured fashion ? Is there a way to correct it ?
>
> 2. When I start two instants of this application and attempt to update
> the same record, there seem to have no check in the content of the
> record prior to the update(). The 2nd update will wipe out all changes
> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
> not check the content of the record. What should be the proper way to
> implement a Rlock() ? savetoarray.. ?
>
> Thanks.
> David
>
>
>
>
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Sample in DBFData2
David,
1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
> in the captured fashion ? Is there a way to correct it ?
Is just a bug on the demo that is already fixed. Just change the following:
STATIC FUNCTION FirstLast( oDataField )
LOCAL cText
WITH OBJECT oDataField:oDataSet
cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
END WITH
RETURN cText
> 2. When I start two instants of this application and attempt to update
> the same record, there seem to have no check in the content of the
> record prior to the update(). The 2nd update will wipe out all changes
> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
> not check the content of the record. What should be the proper way to
> implement a Rlock() ? savetoarray.. ?
You can lock the record with oDataset:Edit( .T. ) or save its content with
oDataSet:GetRecord() and check if something has changed before doing the
Update().
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"david fung" <davfung@yahoo.com> escribió en el mensaje
news:[email=45138b20@news.xailer.com...]45138b20@news.xailer.com...[/email]
> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
> in the captured fashion ? Is there a way to correct it ?
>
> 2. When I start two instants of this application and attempt to update
> the same record, there seem to have no check in the content of the
> record prior to the update(). The 2nd update will wipe out all changes
> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
> not check the content of the record. What should be the proper way to
> implement a Rlock() ? savetoarray.. ?
>
> Thanks.
> David
>
>
>
>
1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
> in the captured fashion ? Is there a way to correct it ?
Is just a bug on the demo that is already fixed. Just change the following:
STATIC FUNCTION FirstLast( oDataField )
LOCAL cText
WITH OBJECT oDataField:oDataSet
cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
END WITH
RETURN cText
> 2. When I start two instants of this application and attempt to update
> the same record, there seem to have no check in the content of the
> record prior to the update(). The 2nd update will wipe out all changes
> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
> not check the content of the record. What should be the proper way to
> implement a Rlock() ? savetoarray.. ?
You can lock the record with oDataset:Edit( .T. ) or save its content with
oDataSet:GetRecord() and check if something has changed before doing the
Update().
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"david fung" <davfung@yahoo.com> escribió en el mensaje
news:[email=45138b20@news.xailer.com...]45138b20@news.xailer.com...[/email]
> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
> in the captured fashion ? Is there a way to correct it ?
>
> 2. When I start two instants of this application and attempt to update
> the same record, there seem to have no check in the content of the
> record prior to the update(). The 2nd update will wipe out all changes
> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
> not check the content of the record. What should be the proper way to
> implement a Rlock() ? savetoarray.. ?
>
> Thanks.
> David
>
>
>
>
-
- Mensajes: 257
- Registrado: Mié Jul 19, 2006 8:48 am
Sample in DBFData2
Ignacio Ortiz de Zúñiga wrote:
> David,
>
> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>> in the captured fashion ? Is there a way to correct it ?
>
> Is just a bug on the demo that is already fixed. Just change the following:
>
> STATIC FUNCTION FirstLast( oDataField )
>
> LOCAL cText
>
> WITH OBJECT oDataField:oDataSet
> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
> END WITH
>
> RETURN cText
>
>> 2. When I start two instants of this application and attempt to update
>> the same record, there seem to have no check in the content of the
>> record prior to the update(). The 2nd update will wipe out all changes
>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>> not check the content of the record. What should be the proper way to
>> implement a Rlock() ? savetoarray.. ?
>
> You can lock the record with oDataset:Edit( .T. ) or save its content with
> oDataSet:GetRecord() and check if something has changed before doing the
> Update().
>
> Regards,
What is the proper way to save up an record ?
oSavedRecord := oDbfDataSet1:GetRecord() ?
At update
if oSavedRecord == oDbfDataSet1:GetRecord()
oDbfDataSet1:Update()
else
MsgInfo( "Record was updated by another user, changes aborted !")
oDbfDataSet1:Cancel()
endif
> David,
>
> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>> in the captured fashion ? Is there a way to correct it ?
>
> Is just a bug on the demo that is already fixed. Just change the following:
>
> STATIC FUNCTION FirstLast( oDataField )
>
> LOCAL cText
>
> WITH OBJECT oDataField:oDataSet
> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
> END WITH
>
> RETURN cText
>
>> 2. When I start two instants of this application and attempt to update
>> the same record, there seem to have no check in the content of the
>> record prior to the update(). The 2nd update will wipe out all changes
>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>> not check the content of the record. What should be the proper way to
>> implement a Rlock() ? savetoarray.. ?
>
> You can lock the record with oDataset:Edit( .T. ) or save its content with
> oDataSet:GetRecord() and check if something has changed before doing the
> Update().
>
> Regards,
What is the proper way to save up an record ?
oSavedRecord := oDbfDataSet1:GetRecord() ?
At update
if oSavedRecord == oDbfDataSet1:GetRecord()
oDbfDataSet1:Update()
else
MsgInfo( "Record was updated by another user, changes aborted !")
oDbfDataSet1:Cancel()
endif
-
- Mensajes: 257
- Registrado: Mié Jul 19, 2006 8:48 am
Sample in DBFData2
Ignacio Ortiz de Zúñiga wrote:
> David,
>
> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>> in the captured fashion ? Is there a way to correct it ?
>
> Is just a bug on the demo that is already fixed. Just change the following:
>
> STATIC FUNCTION FirstLast( oDataField )
>
> LOCAL cText
>
> WITH OBJECT oDataField:oDataSet
> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
> END WITH
>
> RETURN cText
>
>> 2. When I start two instants of this application and attempt to update
>> the same record, there seem to have no check in the content of the
>> record prior to the update(). The 2nd update will wipe out all changes
>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>> not check the content of the record. What should be the proper way to
>> implement a Rlock() ? savetoarray.. ?
>
> You can lock the record with oDataset:Edit( .T. ) or save its content with
> oDataSet:GetRecord() and check if something has changed before doing the
> Update().
>
> Regards,
What is the proper way to save up an record ?
oSavedRecord := oDbfDataSet1:GetRecord() ?
At update
if oSavedRecord == oDbfDataSet1:GetRecord()
oDbfDataSet1:Update()
else
MsgInfo( "Record was updated by another user, changes aborted !")
oDbfDataSet1:Cancel()
endif
> David,
>
> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>> in the captured fashion ? Is there a way to correct it ?
>
> Is just a bug on the demo that is already fixed. Just change the following:
>
> STATIC FUNCTION FirstLast( oDataField )
>
> LOCAL cText
>
> WITH OBJECT oDataField:oDataSet
> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
> END WITH
>
> RETURN cText
>
>> 2. When I start two instants of this application and attempt to update
>> the same record, there seem to have no check in the content of the
>> record prior to the update(). The 2nd update will wipe out all changes
>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>> not check the content of the record. What should be the proper way to
>> implement a Rlock() ? savetoarray.. ?
>
> You can lock the record with oDataset:Edit( .T. ) or save its content with
> oDataSet:GetRecord() and check if something has changed before doing the
> Update().
>
> Regards,
What is the proper way to save up an record ?
oSavedRecord := oDbfDataSet1:GetRecord() ?
At update
if oSavedRecord == oDbfDataSet1:GetRecord()
oDbfDataSet1:Update()
else
MsgInfo( "Record was updated by another user, changes aborted !")
oDbfDataSet1:Cancel()
endif
-
- Mensajes: 257
- Registrado: Mié Jul 19, 2006 8:48 am
Sample in DBFData2
david fung wrote:
> Ignacio Ortiz de Zúñiga wrote:
>> David,
>>
>> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>>> in the captured fashion ? Is there a way to correct it ?
>>
>> Is just a bug on the demo that is already fixed. Just change the
>> following:
>>
>> STATIC FUNCTION FirstLast( oDataField )
>>
>> LOCAL cText
>>
>> WITH OBJECT oDataField:oDataSet
>> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
>> END WITH
>>
>> RETURN cText
>>
>>> 2. When I start two instants of this application and attempt to update
>>> the same record, there seem to have no check in the content of the
>>> record prior to the update(). The 2nd update will wipe out all changes
>>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>>> not check the content of the record. What should be the proper way to
>>> implement a Rlock() ? savetoarray.. ?
>>
>> You can lock the record with oDataset:Edit( .T. ) or save its content
>> with oDataSet:GetRecord() and check if something has changed before
>> doing the Update().
>>
>> Regards,
>
What is the proper way to save up an record ?
oSavedRecord := oDbfDataSet1:GetRecord() ?
At update
if oSavedRecord == oDbfDataSet1:GetRecord()
oDbfDataSet1:Update()
else
MsgInfo( "Record was updated by another user, changes aborted !")
oDbfDataSet1:Cancel()
endif
Any comment on the above routine ?
> Ignacio Ortiz de Zúñiga wrote:
>> David,
>>
>> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>>> in the captured fashion ? Is there a way to correct it ?
>>
>> Is just a bug on the demo that is already fixed. Just change the
>> following:
>>
>> STATIC FUNCTION FirstLast( oDataField )
>>
>> LOCAL cText
>>
>> WITH OBJECT oDataField:oDataSet
>> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
>> END WITH
>>
>> RETURN cText
>>
>>> 2. When I start two instants of this application and attempt to update
>>> the same record, there seem to have no check in the content of the
>>> record prior to the update(). The 2nd update will wipe out all changes
>>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>>> not check the content of the record. What should be the proper way to
>>> implement a Rlock() ? savetoarray.. ?
>>
>> You can lock the record with oDataset:Edit( .T. ) or save its content
>> with oDataSet:GetRecord() and check if something has changed before
>> doing the Update().
>>
>> Regards,
>
What is the proper way to save up an record ?
oSavedRecord := oDbfDataSet1:GetRecord() ?
At update
if oSavedRecord == oDbfDataSet1:GetRecord()
oDbfDataSet1:Update()
else
MsgInfo( "Record was updated by another user, changes aborted !")
oDbfDataSet1:Cancel()
endif
Any comment on the above routine ?
-
- Mensajes: 257
- Registrado: Mié Jul 19, 2006 8:48 am
Sample in DBFData2
david fung wrote:
> Ignacio Ortiz de Zúñiga wrote:
>> David,
>>
>> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>>> in the captured fashion ? Is there a way to correct it ?
>>
>> Is just a bug on the demo that is already fixed. Just change the
>> following:
>>
>> STATIC FUNCTION FirstLast( oDataField )
>>
>> LOCAL cText
>>
>> WITH OBJECT oDataField:oDataSet
>> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
>> END WITH
>>
>> RETURN cText
>>
>>> 2. When I start two instants of this application and attempt to update
>>> the same record, there seem to have no check in the content of the
>>> record prior to the update(). The 2nd update will wipe out all changes
>>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>>> not check the content of the record. What should be the proper way to
>>> implement a Rlock() ? savetoarray.. ?
>>
>> You can lock the record with oDataset:Edit( .T. ) or save its content
>> with oDataSet:GetRecord() and check if something has changed before
>> doing the Update().
>>
>> Regards,
>
What is the proper way to save up an record ?
oSavedRecord := oDbfDataSet1:GetRecord() ?
At update
if oSavedRecord == oDbfDataSet1:GetRecord()
oDbfDataSet1:Update()
else
MsgInfo( "Record was updated by another user, changes aborted !")
oDbfDataSet1:Cancel()
endif
Any comment on the above routine ?
> Ignacio Ortiz de Zúñiga wrote:
>> David,
>>
>> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>>> in the captured fashion ? Is there a way to correct it ?
>>
>> Is just a bug on the demo that is already fixed. Just change the
>> following:
>>
>> STATIC FUNCTION FirstLast( oDataField )
>>
>> LOCAL cText
>>
>> WITH OBJECT oDataField:oDataSet
>> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last( dsFIELD ) )
>> END WITH
>>
>> RETURN cText
>>
>>> 2. When I start two instants of this application and attempt to update
>>> the same record, there seem to have no check in the content of the
>>> record prior to the update(). The 2nd update will wipe out all changes
>>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>>> not check the content of the record. What should be the proper way to
>>> implement a Rlock() ? savetoarray.. ?
>>
>> You can lock the record with oDataset:Edit( .T. ) or save its content
>> with oDataSet:GetRecord() and check if something has changed before
>> doing the Update().
>>
>> Regards,
>
What is the proper way to save up an record ?
oSavedRecord := oDbfDataSet1:GetRecord() ?
At update
if oSavedRecord == oDbfDataSet1:GetRecord()
oDbfDataSet1:Update()
else
MsgInfo( "Record was updated by another user, changes aborted !")
oDbfDataSet1:Cancel()
endif
Any comment on the above routine ?
- ignacio
- Site Admin
- Mensajes: 9441
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Sample in DBFData2
David,
> At update
>
> if oSavedRecord == oDbfDataSet1:GetRecord()
> oDbfDataSet1:Update()
> else
> MsgInfo( "Record was updated by another user, changes aborted !")
> oDbfDataSet1:Cancel()
> endif
>
>
> Any comment on the above routine ?
It will not work. You can not compare the two objects that way. That
comparition only tells if boh are exactly the same object, which is always
not true in your case. Yo should compare all its members:
FUNCTION RecordsEqual( oRec1, oRec2 )
Local nFor
Local aValues1, aValues2
aValues1 := oRec1:GetValues()
aValues2 := oRec2:GetValues()
FOR nFor := 1 TO Len( aValues1 )
IF aValues1[ nFor ] != aValues2[ nFor ]
RETURN .F.
ENDIF
NEXT
RETURN .T.
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"david fung" <davfung@yahoo.com> escribió en el mensaje
news:[email=451b8e2a@news.xailer.com...]451b8e2a@news.xailer.com...[/email]
> david fung wrote:
>> Ignacio Ortiz de Zúñiga wrote:
>>> David,
>>>
>>> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>>>> in the captured fashion ? Is there a way to correct it ?
>>>
>>> Is just a bug on the demo that is already fixed. Just change the
>>> following:
>>>
>>> STATIC FUNCTION FirstLast( oDataField )
>>>
>>> LOCAL cText
>>>
>>> WITH OBJECT oDataField:oDataSet
>>> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last(
>>> dsFIELD ) )
>>> END WITH
>>>
>>> RETURN cText
>>>
>>>> 2. When I start two instants of this application and attempt to update
>>>> the same record, there seem to have no check in the content of the
>>>> record prior to the update(). The 2nd update will wipe out all changes
>>>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>>>> not check the content of the record. What should be the proper way to
>>>> implement a Rlock() ? savetoarray.. ?
>>>
>>> You can lock the record with oDataset:Edit( .T. ) or save its content
>>> with oDataSet:GetRecord() and check if something has changed before
>>> doing the Update().
>>>
>>> Regards,
>>
>
>
> What is the proper way to save up an record ?
>
> oSavedRecord := oDbfDataSet1:GetRecord() ?
>
>
> At update
>
> if oSavedRecord == oDbfDataSet1:GetRecord()
> oDbfDataSet1:Update()
> else
> MsgInfo( "Record was updated by another user, changes aborted !")
> oDbfDataSet1:Cancel()
> endif
>
>
> Any comment on the above routine ?
> At update
>
> if oSavedRecord == oDbfDataSet1:GetRecord()
> oDbfDataSet1:Update()
> else
> MsgInfo( "Record was updated by another user, changes aborted !")
> oDbfDataSet1:Cancel()
> endif
>
>
> Any comment on the above routine ?
It will not work. You can not compare the two objects that way. That
comparition only tells if boh are exactly the same object, which is always
not true in your case. Yo should compare all its members:
FUNCTION RecordsEqual( oRec1, oRec2 )
Local nFor
Local aValues1, aValues2
aValues1 := oRec1:GetValues()
aValues2 := oRec2:GetValues()
FOR nFor := 1 TO Len( aValues1 )
IF aValues1[ nFor ] != aValues2[ nFor ]
RETURN .F.
ENDIF
NEXT
RETURN .T.
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"david fung" <davfung@yahoo.com> escribió en el mensaje
news:[email=451b8e2a@news.xailer.com...]451b8e2a@news.xailer.com...[/email]
> david fung wrote:
>> Ignacio Ortiz de Zúñiga wrote:
>>> David,
>>>
>>> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>>>> in the captured fashion ? Is there a way to correct it ?
>>>
>>> Is just a bug on the demo that is already fixed. Just change the
>>> following:
>>>
>>> STATIC FUNCTION FirstLast( oDataField )
>>>
>>> LOCAL cText
>>>
>>> WITH OBJECT oDataField:oDataSet
>>> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last(
>>> dsFIELD ) )
>>> END WITH
>>>
>>> RETURN cText
>>>
>>>> 2. When I start two instants of this application and attempt to update
>>>> the same record, there seem to have no check in the content of the
>>>> record prior to the update(). The 2nd update will wipe out all changes
>>>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>>>> not check the content of the record. What should be the proper way to
>>>> implement a Rlock() ? savetoarray.. ?
>>>
>>> You can lock the record with oDataset:Edit( .T. ) or save its content
>>> with oDataSet:GetRecord() and check if something has changed before
>>> doing the Update().
>>>
>>> Regards,
>>
>
>
> What is the proper way to save up an record ?
>
> oSavedRecord := oDbfDataSet1:GetRecord() ?
>
>
> At update
>
> if oSavedRecord == oDbfDataSet1:GetRecord()
> oDbfDataSet1:Update()
> else
> MsgInfo( "Record was updated by another user, changes aborted !")
> oDbfDataSet1:Cancel()
> endif
>
>
> Any comment on the above routine ?
Ignacio Ortiz de Zúñiga
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
[OZ Software]
https://www.ozs.es
--
[Equipo de Xailer / Xailer team]
https://www.xailer.com
Sample in DBFData2
David,
> At update
>
> if oSavedRecord == oDbfDataSet1:GetRecord()
> oDbfDataSet1:Update()
> else
> MsgInfo( "Record was updated by another user, changes aborted !")
> oDbfDataSet1:Cancel()
> endif
>
>
> Any comment on the above routine ?
It will not work. You can not compare the two objects that way. That
comparition only tells if boh are exactly the same object, which is always
not true in your case. Yo should compare all its members:
FUNCTION RecordsEqual( oRec1, oRec2 )
Local nFor
Local aValues1, aValues2
aValues1 := oRec1:GetValues()
aValues2 := oRec2:GetValues()
FOR nFor := 1 TO Len( aValues1 )
IF aValues1[ nFor ] != aValues2[ nFor ]
RETURN .F.
ENDIF
NEXT
RETURN .T.
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"david fung" <davfung@yahoo.com> escribió en el mensaje
news:[email=451b8e2a@news.xailer.com...]451b8e2a@news.xailer.com...[/email]
> david fung wrote:
>> Ignacio Ortiz de Zúñiga wrote:
>>> David,
>>>
>>> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>>>> in the captured fashion ? Is there a way to correct it ?
>>>
>>> Is just a bug on the demo that is already fixed. Just change the
>>> following:
>>>
>>> STATIC FUNCTION FirstLast( oDataField )
>>>
>>> LOCAL cText
>>>
>>> WITH OBJECT oDataField:oDataSet
>>> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last(
>>> dsFIELD ) )
>>> END WITH
>>>
>>> RETURN cText
>>>
>>>> 2. When I start two instants of this application and attempt to update
>>>> the same record, there seem to have no check in the content of the
>>>> record prior to the update(). The 2nd update will wipe out all changes
>>>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>>>> not check the content of the record. What should be the proper way to
>>>> implement a Rlock() ? savetoarray.. ?
>>>
>>> You can lock the record with oDataset:Edit( .T. ) or save its content
>>> with oDataSet:GetRecord() and check if something has changed before
>>> doing the Update().
>>>
>>> Regards,
>>
>
>
> What is the proper way to save up an record ?
>
> oSavedRecord := oDbfDataSet1:GetRecord() ?
>
>
> At update
>
> if oSavedRecord == oDbfDataSet1:GetRecord()
> oDbfDataSet1:Update()
> else
> MsgInfo( "Record was updated by another user, changes aborted !")
> oDbfDataSet1:Cancel()
> endif
>
>
> Any comment on the above routine ?
> At update
>
> if oSavedRecord == oDbfDataSet1:GetRecord()
> oDbfDataSet1:Update()
> else
> MsgInfo( "Record was updated by another user, changes aborted !")
> oDbfDataSet1:Cancel()
> endif
>
>
> Any comment on the above routine ?
It will not work. You can not compare the two objects that way. That
comparition only tells if boh are exactly the same object, which is always
not true in your case. Yo should compare all its members:
FUNCTION RecordsEqual( oRec1, oRec2 )
Local nFor
Local aValues1, aValues2
aValues1 := oRec1:GetValues()
aValues2 := oRec2:GetValues()
FOR nFor := 1 TO Len( aValues1 )
IF aValues1[ nFor ] != aValues2[ nFor ]
RETURN .F.
ENDIF
NEXT
RETURN .T.
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"david fung" <davfung@yahoo.com> escribió en el mensaje
news:[email=451b8e2a@news.xailer.com...]451b8e2a@news.xailer.com...[/email]
> david fung wrote:
>> Ignacio Ortiz de Zúñiga wrote:
>>> David,
>>>
>>> 1. I wonder why the content (a "Calcfield" )of the oDBBrowse displayed
>>>> in the captured fashion ? Is there a way to correct it ?
>>>
>>> Is just a bug on the demo that is already fixed. Just change the
>>> following:
>>>
>>> STATIC FUNCTION FirstLast( oDataField )
>>>
>>> LOCAL cText
>>>
>>> WITH OBJECT oDataField:oDataSet
>>> cText := Trim( :First( dsFIELD ) ) + " " + Trim( :Last(
>>> dsFIELD ) )
>>> END WITH
>>>
>>> RETURN cText
>>>
>>>> 2. When I start two instants of this application and attempt to update
>>>> the same record, there seem to have no check in the content of the
>>>> record prior to the update(). The 2nd update will wipe out all changes
>>>> from the 1st update. attempt to use oDbfDataSet1:Reclock(), but it does
>>>> not check the content of the record. What should be the proper way to
>>>> implement a Rlock() ? savetoarray.. ?
>>>
>>> You can lock the record with oDataset:Edit( .T. ) or save its content
>>> with oDataSet:GetRecord() and check if something has changed before
>>> doing the Update().
>>>
>>> Regards,
>>
>
>
> What is the proper way to save up an record ?
>
> oSavedRecord := oDbfDataSet1:GetRecord() ?
>
>
> At update
>
> if oSavedRecord == oDbfDataSet1:GetRecord()
> oDbfDataSet1:Update()
> else
> MsgInfo( "Record was updated by another user, changes aborted !")
> oDbfDataSet1:Cancel()
> endif
>
>
> Any comment on the above routine ?
-
- Mensajes: 257
- Registrado: Mié Jul 19, 2006 8:48 am
Sample in DBFData2
Ignacio Ortiz de Zúñiga wrote:
> David,
>
>> At update
>>
>> if oSavedRecord == oDbfDataSet1:GetRecord()
>> oDbfDataSet1:Update()
>> else
>> MsgInfo( "Record was updated by another user, changes aborted !")
>> oDbfDataSet1:Cancel()
>> endif
>>
>>
>> Any comment on the above routine ?
>
> It will not work. You can not compare the two objects that way. That
> comparition only tells if boh are exactly the same object, which is always
> not true in your case. Yo should compare all its members:
>
> FUNCTION RecordsEqual( oRec1, oRec2 )
>
> Local nFor
> Local aValues1, aValues2
>
> aValues1 := oRec1:GetValues()
> aValues2 := oRec2:GetValues()
>
> FOR nFor := 1 TO Len( aValues1 )
> IF aValues1[ nFor ] != aValues2[ nFor ]
> RETURN .F.
> ENDIF
> NEXT
>
> RETURN .T.
>
>
Great, thank you I'll try that.
> David,
>
>> At update
>>
>> if oSavedRecord == oDbfDataSet1:GetRecord()
>> oDbfDataSet1:Update()
>> else
>> MsgInfo( "Record was updated by another user, changes aborted !")
>> oDbfDataSet1:Cancel()
>> endif
>>
>>
>> Any comment on the above routine ?
>
> It will not work. You can not compare the two objects that way. That
> comparition only tells if boh are exactly the same object, which is always
> not true in your case. Yo should compare all its members:
>
> FUNCTION RecordsEqual( oRec1, oRec2 )
>
> Local nFor
> Local aValues1, aValues2
>
> aValues1 := oRec1:GetValues()
> aValues2 := oRec2:GetValues()
>
> FOR nFor := 1 TO Len( aValues1 )
> IF aValues1[ nFor ] != aValues2[ nFor ]
> RETURN .F.
> ENDIF
> NEXT
>
> RETURN .T.
>
>
Great, thank you I'll try that.
-
- Mensajes: 257
- Registrado: Mié Jul 19, 2006 8:48 am
Sample in DBFData2
Ignacio Ortiz de Zúñiga wrote:
> David,
>
>> At update
>>
>> if oSavedRecord == oDbfDataSet1:GetRecord()
>> oDbfDataSet1:Update()
>> else
>> MsgInfo( "Record was updated by another user, changes aborted !")
>> oDbfDataSet1:Cancel()
>> endif
>>
>>
>> Any comment on the above routine ?
>
> It will not work. You can not compare the two objects that way. That
> comparition only tells if boh are exactly the same object, which is always
> not true in your case. Yo should compare all its members:
>
> FUNCTION RecordsEqual( oRec1, oRec2 )
>
> Local nFor
> Local aValues1, aValues2
>
> aValues1 := oRec1:GetValues()
> aValues2 := oRec2:GetValues()
>
> FOR nFor := 1 TO Len( aValues1 )
> IF aValues1[ nFor ] != aValues2[ nFor ]
> RETURN .F.
> ENDIF
> NEXT
>
> RETURN .T.
>
>
Great, thank you I'll try that.
> David,
>
>> At update
>>
>> if oSavedRecord == oDbfDataSet1:GetRecord()
>> oDbfDataSet1:Update()
>> else
>> MsgInfo( "Record was updated by another user, changes aborted !")
>> oDbfDataSet1:Cancel()
>> endif
>>
>>
>> Any comment on the above routine ?
>
> It will not work. You can not compare the two objects that way. That
> comparition only tells if boh are exactly the same object, which is always
> not true in your case. Yo should compare all its members:
>
> FUNCTION RecordsEqual( oRec1, oRec2 )
>
> Local nFor
> Local aValues1, aValues2
>
> aValues1 := oRec1:GetValues()
> aValues2 := oRec2:GetValues()
>
> FOR nFor := 1 TO Len( aValues1 )
> IF aValues1[ nFor ] != aValues2[ nFor ]
> RETURN .F.
> ENDIF
> NEXT
>
> RETURN .T.
>
>
Great, thank you I'll try that.