Re: What items were changed?

From: Simon Hedges <shedges_at_hhhh.freeserve.co.uk>
Date: Sun, 17 Oct 1999 19:28:24 +0100
Message-ID: <7ud47j$9lq$1_at_news5.svr.pol.co.uk>


You say ". Is there better solution to track the changes that are made onto a
> database record (from the form)?"

In principle, I think your solution (or a variable thereof) is really the only one
if you are restricted to using Forms. However, rather than use global variable and writing the code in the Form, I've implemented similar things in a DB Table Trigger instead. This generates less network traffic, tends to use less code, leaves you with a smaller application, and will record any change to the data, whether it comes from the Form or not.

In DB triggers, Oracle already knows the existing value of the column (it's held in a variable named :old.mycolumnname) and knows the new value (it's held in a variable named :new.mycolumnname). So you can write something along the lines of :

If :new.mycolumnname <> :old.mycolumnname then....

Simon Hedges
Gloucester
UK

> I have a form which records data into a COMPANY table. Now, say if there
is
> some modification that needs
> to be made on CompanyX. CompanyX just got sold and is now called CompanyY.
> So the user opens the
> form, and changes the company name from CompanyX to CompanyY, and then
saves
> the form. Is there
> any way for us to track the fact that a change was made. And it could be
> any type of change that was made on
> the record, not just name change?
>
> I was thinking of creating a separate table called
> COMPANY_HISTORY(date,companyid,fieldname, oldfieldvalue,newfieldvalue).
> Then when-update-item fires, storing all the 17 field values of the
current
> record into 17 temporary global variables. And when post-commit fires,
> comparing each of the 17 fieldvalues
> with what is stored in those global variables. If any item doesn't match,
> add it onto the COMPANY_HISTORY
> table. It seems like this can work, but rather clumsily, since I have to
> enter 17 if-then comparisions for each
> field. Is there better solution to track the changes that are made onto a
> database record (from the form)?
>
> The idea is so that when the users are going thru the companies, they can
> click on the history button, and up comes
> a list showing exactly what was modified on this company, who modified it,
> and when was it modified.
>
> Thanks,
> Chris
>
>
Received on Sun Oct 17 1999 - 20:28:24 CEST

Original text of this message