Jim,
I do something similar for an audit system to track when and who changed data.
Make an EEP to track values from a table (Audit_Table_Var), run it as a Custom
Layout and as part of After Start to set the values. Use the ON EXIT EEP at
each field to check if there are any changes. If there are changes the CmdCode
will move the changes to wherever you tell it to load. I keep CmdCode in a
table with various versions for note, integer, text formats. It is run by the
RUN SELECT command in line 6 of the ON EXIT EEP. You should be able to replace
this with a simple update for your second table. CLEAR VAR a%, deletes all the
varibles when needed. I like this way because you can jump to any field and it
changes just that field. I have a couple of forms that have over 60 fields on
each page. It is very fast. It also stays very specific to the field when a
problem needs to be fixed. Probably overkill, but it meets my needs.
Audit_Table_Var in Custom Layout:
SELECT +
ZHousHistLiving,ZHousHistLivNote, ZHousCurrLiving,ZHousCurrLivNote, +
ZHousOthers,ZHousOtherRel +
INTO +
aZHousHistLiving INDICATOR a1, +
aZHousHistLivNote INDICATOR a2, +
aZHousCurrLiving INDICATOR A3, +
aZHousCurrLivNote INDICATOR A4, +
aZHousOthers INDICATOR A5, +
aZHousOtherRel INDICATOR a6 +
FROM Z_House_Info WHERE (ZID = .vZID)
AFTER START FORM EEP:
--Load Line Restore vars
SET VAR vTableName TEXT = 'Z_House_Info'
SET VAR vA_Line INTEGER = 0
SET VAR vA_LineName TEXT = 'None'
--Drop existing audit vars
CLEAR VAR a%
--Load audit vars
PROPERTY RBASE_FORM_ACTION 'Audit_Table_Var' ' '
RETURN
OnExit EEP for each field:
SAVEROW
SET VAR vColName TEXT = 'ZHousHistLivNote '
SET VAR aCurNote NOTE = (.aZHousHistLivNote)
SET VAR aNewNote NOTE = ZHousHistLivNote IN Z_House_Info WHERE (ZID = .vZID)
SET VAR vA_Type TEXT = 'Note'
RUN SELECT CmdCode FROM RMD_FILES WHERE CmdName = 'Audit_ZNote'
CLEAR VAR vColname, vA_Type
RETURN
CmdCode is this. It simply puts any changes where you want them. This loads to
Z_Audit_Date.
IF aNewNote = (.aCurNote) THEN
GOTO MoveOn
ENDIF
IF aNewNote <> (.aCurNote) THEN
PROJECT TEMPORARY tAuditData FROM Z_Audit_Data USING * WHERE AuditID = 0
INSERT INTO tAuditData +
VALUES (1, .vZID, .vEIDW, .vTableName, .vColName, .vA_Type, .vA_Line, +
.vA_LineName,.aCurText, .aNewText, .aCurNote, .aNewNote, .#DATE, .#TIME, +
.vEIDW, .gNetuser, .gNetComputer)
APPEND tAuditData TO Z_Audit_Data
DROP TABLE tAuditData
CLEAR VARIABLES a%
PROPERTY RBASE_FORM_ACTION 'Audit_Table_Var' ' '
ENDIF
LABEL MoveOn
Tom Frederick
President/CEO
Elm City Center
1314 W Walnut
Jacksonville, IL 62650
W- 217-245-9504
F - 217-245-2350
E - [email protected]
-----Original Message-----
From: "Jim Belisle" <[email protected]>
To: [email protected] (RBASE-L Mailing List)
Date: Sat, 26 Mar 2011 15:59:33 -0500
Subject: [RBASE-L] - [No Subject]
I have two tables that have the same type information.
When updating one table with a form, I want to be able to update the other
table at the same time.
Since there are 40 fields and I would not know which field might be edited,
what would be the best way to go about this?
Would I have to have a compID on all FIELDS then have the update command always
update all fields?
Any suggestions would be appreciated. All fields are text fields
James Belisle