Susan,
On a Windows system, you can write to the Event Log so that you can at
least leave some 'footprints' when this happens - it's a general problem
when you use Transaction State because it rolls back EVERYTHING which
makes it hard when the transaction has been created from UniObjects.
What I did was to use the "UVRunCommand()" function to call the DOS
function "eventcreate", like this:-
==================================================================
DOS.STRING = 'eventcreate /T ':EVENT.TYPE
DOS.STRING := ' /ID ':EVENT.ID
DOS.STRING := ' /L ':EVENT.LOG
DOS.STRING := ' /SO ':QUOTE(EVENT.SOURCE)
DOS.STRING := ' /D ':QUOTE(EVENT.DESCRIPTION)
DOS.STATUS = UVRunCommand('c:\WINDOWS\system32\cmd.exe /c ':DOS.STRING)
==================================================================
Notes:
1) "UVRunCommand()" will work in Transaction State, whereas "PERFORM
'DOS \c ...'" won't
2) You can get most of the details on "eventcreate" by typing
"eventcreate /?" at a Windows Command-Line (DOS) prompt.
3) It seems like you can't use the same 'Event Source' string to log
events in more than one of the System and Application Event logs
4) Works on Windows XP, Windows Server 2003 and Windows Server 2008.
Probably works on lots of Windows platforms, I just haven't tried it.
5) I wrapped all the code in a called SUBROUTINE so I could put in
sensible defaults etc.
YMMV and non-Windows platforms will obviously require different
solutions
Regards
Mike
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Susan Joslyn
Sent: Wednesday, 3 December 2008 2:16 a.m.
To: [email protected]
Subject: Re: [U2] Universe triggers (still more)
Thanks to the folks who gave me info on Unidata triggers. I've had
those
implemented for years and they do work very simply and well. Universe
has
been a whole different ballgame.
It turns out that Universe has cleverly adapted the triggers from SQL.
I
say cleverly because it probably really is on some esoteric mathematical
level. And certain from a viewpoint of 'using what you have'. But for
an
old Pickie like me it has been very foreign. Also they have made use of
the
Begin Transaction business - so that the writes can be rolled back using
that existing logic, I reckon. Again, good re-use. But this is also an
area
that I'm not familiar with.
The three problems that I had were with:
1) The SB+ COMMON block - this was resolved by adding $OPTIONS PICK to
the
trigger program - and to all the programs down the line that it called.
2) WRITES requiring locks: The Begin Transaction relies on a system
variable
called ISOMODE which can be set to 0,1 or 2 to control how rigorous the
locking requirements are - as part of the 'transaction/rollback' stuff.
I
was able to get my programs working by making sure I had a READU before
each
WRITE (which I didn't have in some cases - where I had decided in my own
wisdom that it was safe not to do it - audit logs, new items, etc.) but
I
can't get into the SB+ code and the authors thereof were also of this
same
wisdom. But it turned out that by using Uniadmin to set ISOMODE to 0,
this
problem was alleviated.
3) Last, I wanted to be able to control whether the write should occur.
I
can do it - the manual was not clear on the syntax and I kept thinking
there
was something more, but apparently as long as I put:
DUMMY = SetDiagnostics("This message is about why the item cannot be
written"), the trigger will fail the write and display that message. I
don't
display that message, I don't use the variable DUMMY, I don't set any
particular flag. The display and the failure to write is not pretty.
4) One thing I cannot overcome is that the triggers in Universe will not
permit any interaction. So my program can't explain to the user why it
doesn't think they should write and then allow them to make a decision.
It
throws them back into their item, though, so I guess they can save the
item
somewhere else or something from there.
Again, thanks to Manu in particular who has obviously fought the exact
same
battle - and to those of you who offered up the "how to" in Unidata.
You
are so lucky you are doing it in Unidata!
Hope this helps someone else, some day.
Susan Joslyn
SJ+ Systems Associates, Inc.
PRC(r) Complete software development life-cycle management for U2.
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
The information contained in this Internet Email message is intended
for the addressee only and may contain privileged information, but not
necessarily the official views or opinions of the New Zealand Defence Force.
If you are not the intended recipient you must not use, disclose, copy or
distribute this message or the information in it.
If you have received this message in error, please Email or telephone
the sender immediately.
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/