Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Detect Changes
Wed, Apr 25 2007 2:51 PMPermanent Link

"Petrus van Breda"
Hi

I need to be able to detect if any changes were made to a record and fields.
The database has 150 fields. The user require that if a field change I put
the before and after information in a memo field as an audit trail and link
this to the main record.

Is it possible to take snapshot before any changes and one afterwards and
then detect it whout verifying each field?

They would also like it that if the user didn't change anything the record
are not saved but cancelled.

Hope you can help me.

Thanks

Petrus

Wed, Apr 25 2007 4:36 PMPermanent Link

"Robert"

"Petrus van Breda" <petrus@spsoftdev.com> wrote in message
news:10A45342-AC20-4A1E-BA38-92B0C072DF27@news.elevatesoft.com...
> Hi
>
> I need to be able to detect if any changes were made to a record and
> fields. The database has 150 fields. The user require that if a field
> change I put the before and after information in a memo field as an audit
> trail and link this to the main record.
>
> Is it possible to take snapshot before any changes and one afterwards and
> then detect it whout verifying each field?
>
> They would also like it that if the user didn't change anything the record
> are not saved but cancelled.
>

Look at Field.Oldvalue before posting, and compare it to the Field.Value.
You will need to loop thru all the fields.

Robert


Fri, Apr 27 2007 5:57 AMPermanent Link

Chris Erdal
"Petrus van Breda" <petrus@spsoftdev.com> wrote in
news:10A45342-AC20-4A1E-BA38-92B0C072DF27@news.elevatesoft.com:

> Hi
>
> I need to be able to detect if any changes were made to a record and
> fields. The database has 150 fields. The user require that if a field
> change I put the before and after information in a memo field as an
> audit trail and link this to the main record.
>
> Is it possible to take snapshot before any changes and one afterwards
> and then detect it whout verifying each field?
>

from the DBISAM Help file:

Property TDBISAMRecord.Modified

property Modified: Boolean

The Modified property indicates whether the current record has been
modified since the insert, update, or delete operation started.  The
Modified property is initially False at the beginning of an insert,
update or delete, and is only set to True if a Before or After trigger,
or an error handler, modifies the current record.

For usage please refer to the Customizing the Engine section in the
Using DBISAM chapter on page 43.


--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 3 + EDB 1.00 build 6)
Fri, Apr 27 2007 6:11 AMPermanent Link

Chris Erdal
Chris Erdal <chris@No-Spam-erdal.net> wrote in
news:Xns991F794252F7614torcatis@64.65.248.118:

> "Petrus van Breda" <petrus@spsoftdev.com> wrote in
> news:10A45342-AC20-4A1E-BA38-92B0C072DF27@news.elevatesoft.com:
>
>> Hi
>>
>> I need to be able to detect if any changes were made to a record and
>> fields. The database has 150 fields. The user require that if a field
>> change I put the before and after information in a memo field as an
>> audit trail and link this to the main record.
>>
>> Is it possible to take snapshot before any changes and one afterwards
>> and then detect it whout verifying each field?
>>
>
> from the DBISAM Help file:
>
> Property TDBISAMRecord.Modified
>
> property Modified: Boolean
>
> The Modified property indicates whether the current record has been
> modified since the insert, update, or delete operation started.  The
> Modified property is initially False at the beginning of an insert,
> update or delete, and is only set to True if a Before or After trigger,
> or an error handler, modifies the current record.
>
> For usage please refer to the Customizing the Engine section in the
> Using DBISAM chapter on page 43.

Sorry, Petrus.

I meant TDataset.Modified, which tells us if the current record has been
modified.

But I don't think it will check whether somebody has modified something
and then returned it to its original value, so it may give false
positives from time to time.

If that doesn't matter to your client, it'll be simpler than checking
each field's OldValue against its NewValue, but I think you're better off
with  the latter, as Robert suggests.

--
Chris
(XP-Pro + Delphi 7 Architect + DBISAM 4.25 build 3 + EDB 1.00 build 6)
Fri, Apr 27 2007 7:43 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Petrus,

<< Is it possible to take snapshot before any changes and one afterwards and
then detect it whout verifying each field? >>

As Robert indicated, you can use the TField facilities in the application,
or you can use the trigger facilities in the TDBISAMEngine component to do
the same.

<< They would also like it that if the user didn't change anything the
record are not saved but cancelled. >>

That happens anyways with the TDataSet architecture.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image