NetTalk Central

Author Topic: Audit file  (Read 3451 times)

Johan van Zyl

  • Full Member
  • ***
  • Posts: 180
  • jvz
    • View Profile
    • Email
Audit file
« on: October 05, 2014, 01:51:59 PM »
How should this be coded in NTWS?
 alh:actiontaken = Choose(ThisWindow.Request,'Add','Change','Delete')

I get these errors when trying to run "normal" code in NTWS
Unknown identifier: THISWINDOW -
Field not found: REQUEST -
Too few parameters -
Must specify identifier -
Unknown identifier: HISTORY::BRA:RECORD -
Too few parameters -
Must specify identifier -
Unknown identifier: HISTORY::BRA:RECORD -

PostUpdate      Routine
  ! Start of "On Update : Form ends : following disk write"
  ! [Priority 4000]
   Access:auditlogheader.PrimeRecord()
     alh:logtimestamp_DATE = Today()
     alh:logtimestamp_TIME = Clock()
     !alh:username = GLO:Username
     alh:tablename = 'brandnames'
     alh:keyname = 'bra:brandnames_pkey'
     alh:keyvalue = bra:brandnamesysid
     alh:procedurename = GlobalErrors.GetProcedureName()
     alh:actiontaken = Choose(ThisWindow.Request,'Add','Change','Delete')
     Access:auditlogheader.Insert()
     Stream(auditlogdetail)
     Loop i# = 1 to brandnames{Prop:Fields}
         If Clip(What(History::bra:Record,i#)) <> Clip(What(bra:Record,i#))
             Access:auditlogdetail.PrimeRecord()
             ald:auditlogheadersysid = alh:auditlogheadersysid
             ald:columnname = Sub(Who(bra:Record,i#),7,Len(Clip(Who(bra:Record,i#))))
             ald:oldvalue = What(History::bra:Record,i#)
             ald:newvalue = What(bra:Record,i#)
             Access:auditlogdetail.Insert()
         End
     End
  ! End of "On Update : Form ends : following disk write"
Johan van Zyl
Clarion 6.3 9058/C8 Gold/SQL/NetTalk WebServer

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Audit file
« Reply #1 on: October 05, 2014, 10:41:56 PM »
Hi Johan,

I guess you'd get similar issues if you tried that line in Legacy. ThisWindow is an ABC object based on the ABC WindowManager class. Since there are no windows in a web app, and hence no ABC WindowManager, it's not surprising this code is invalid.

Clearly you want to know the "action" the form is set to right? There are 2 variables that contain this for you - loc:act and loc:action.

loc:act is a long which can be matched to equates like Net:InsertRecord, net:ChangeRecord, net:CopyRecord, net:DeleteRecord and net:ViewRecord.

loc:action is a string (set in the SetAction routine) which contains the system "text" of the action. eg, by Default, 'Insert', 'Copy' and so on. (But these can be changed by the programmer.)

Cheers
Bruce