Collecting the Contents of the current window (OpenInsight 16-Bit Specific)
At 03 MAY 2002 08:05:59AM David Schranz wrote:
I wish to create a simple auditing procedure to log any changes made to a window.
I wish to be in a position to collect the contents of the current window and compare the fields with the old values.
To get the old data/record I am reading directly from the table before the record is written, this will give me the old record contents. What I need to do next is to collect the current contents of the data from the screen and compare this with the record read from the table.
Any suggestions?
TKS
David Schranz
At 03 MAY 2002 10:38AM [url=http://www.sprezzatura.com" onMouseOver=window.status= Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
By far the EASIEST way is to do a post write process and reread the row after the write. Or install an MFS to do the same auditing.
At 03 MAY 2002 02:32PM dsig@teleport.com wrote:
Are you trying to just audit the changes OR are you doing some validation with what is in the window?
If you are doing an audit of changes then you want to use an mfs. An MFS will catch changes no matter what process trys to do it. Anything you put in a window will only work against changes in that window.
Audits=MFS
dsig@teleport.com onmouseover=window.status=the new revelation technology .. a refreshing change;return(true)"
David Tod Sigafoos ~ SigSolutions
Phone: 503-639-4240
At 03 MAY 2002 09:57PM Robert Lee wrote:
]What I need to do next is to collect the current contents of the data from the screen and compare this with the record read from the table.
How about performing the WRITE event, and then reading it back (perhaps with an XLATE). You could then make your comparisons and write whatever away to an audit file.
The advantage of doing this in MFS is you won't need to duplicate the code for multiple data entry screens and even if data was changed in the system editor, the audit would be recorded.
Robert Lee
At 07 MAY 2002 11:24PM b cameron wrote:
To answer your question how about the following…
but I would agree the MFS is the way to go. Cut and paste is quick but I love the MFS ideology and functionality
Could make this a procedure and call from POSTWRITE or WRITE event
passing the boundtable or tablename.
How about the following….
* Subroutine TransLogger(Tablename,origrec) * * Note: You may want to get the CTRLMAP and loop through * any edittables for extra vm etc. so the compare works * Record=Get_Property(@Window,"RECORD") * * I also like to use 'session' variables, in the READ event you * could always set the original rec value in memory * Call Set_Property(@Window,"@ORIGREC",origrec) * then get it later * Origrec=Get_Property(@Window,"@ORIGREC") *— STATION=@STATION CONVERT '*' TO '_' IN STATION If (Record OrigRec) Then Open "TRANSACTIONS" To F_TRANSACTIONS Then Num_New_Flds=COUNT(Record,@FM) + (Record "") Num_Old_Flds=COUNT(OrigRec,@FM) + (OrigRec "") If (Num_Old_Flds ] Num_New_Flds) Then Max_Flds=Num_Old_Flds End Else Max_Flds=Num_New_Flds End TLItem=" If Len(OrigRec) Then Convert "~" to "(Tilde)" in OrigRec Convert "~" to "(Tilde)" in Record For i=1 to Max_Flds If OrigRec[i] # Record[i] Then TLItem=i:"~":OrigRec[i]:"~":Record[i] End Next i Type=EDITED" Gosub Write_Trans_Log End Else TLItem=0~NOF~New Record" Type=NEW" Gosub Write_Trans_Log End * now set the orig. to what was just saved to use it again Call Set_Property(@WINDOW,"@ORIGREC",Record) End Else etc=Msg(Parent,"Could not open TRANSACTIONS.!") End End * Return 0 * Write_Trans_Log:* always unique id, no locking needed Key=DATE():"*":TIME():"*":DATAFILE:"*": @ID :"*": @USERNAME :"*": STATION:"*":TYPE Write TLItem on F_TRANSACTIONS,Key Else ETC=Msg(Parent,"Unable to WRITE Transaction id…|":KEY) End Return *