Página 1 de 1

Sample in DBFData2

Publicado: Vie Sep 22, 2006 9:05 am
por david fung
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
--

Sample in DBFData2

Publicado: Vie Sep 22, 2006 9:18 am
por ignacio
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
>
>
>
>

Sample in DBFData2

Publicado: Vie Sep 22, 2006 9:18 am
por NoName
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
>
>
>
>

Sample in DBFData2

Publicado: Lun Sep 25, 2006 10:37 am
por david fung
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

Sample in DBFData2

Publicado: Lun Sep 25, 2006 10:37 am
por david fung
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

Sample in DBFData2

Publicado: Jue Sep 28, 2006 10:56 am
por david fung
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 ?

Sample in DBFData2

Publicado: Jue Sep 28, 2006 10:56 am
por david fung
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 ?

Sample in DBFData2

Publicado: Jue Sep 28, 2006 12:08 pm
por ignacio
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 ?

Sample in DBFData2

Publicado: Jue Sep 28, 2006 12:08 pm
por NoName
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 ?

Sample in DBFData2

Publicado: Vie Sep 29, 2006 1:18 am
por david fung
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.

Sample in DBFData2

Publicado: Vie Sep 29, 2006 1:18 am
por david fung
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.