jeff butera hampshire college http jeff hampshire edu l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Using Triggers to Automate Internal Processing in Unidata PowerPoint Presentation
Download Presentation
Using Triggers to Automate Internal Processing in Unidata

Loading in 2 Seconds...

play fullscreen
1 / 10

Using Triggers to Automate Internal Processing in Unidata - PowerPoint PPT Presentation


  • 174 Views
  • Uploaded on

Jeff Butera - Hampshire College http://jeff.hampshire.edu. Using Triggers to Automate Internal Processing in Unidata. Outline. What is a trigger? What can triggers do? How do I setup a trigger? How do I use them in production? Questions?. What is a trigger?. Piece of executed code

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

Using Triggers to Automate Internal Processing in Unidata


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
outline
Outline

What is a trigger?

What can triggers do?

How do I setup a trigger?

How do I use them in production?

Questions?

what is a trigger
What is a trigger?

Piece of executed code

Triggered by certain events

Unidata Specifics

  • Code is a Unibasic subroutine or function
  • Triggers can be invoked whenever a record is
    • Updated (written)
    • Deleted
what can triggers do
What can triggers do?

Triggers are useful for automated processing

ADDOPR, CHGOPR (?!)

Virtual fields too slow?

No problem – make ‘em computed with a trigger

Stored computed columns

Status and/or status date fields

Notify (email?) when certain things happen...

how do i setup a trigger
How do I setup a trigger?

Create subroutine with 5 arguments:

EXECSTAT (0,1,2)

DICT.FLAG (‘’, ‘DICT’)

FILE (‘STUDENTS’)

ID (‘0023450’)

RECORD

Compile and GLOBALLY catalog

CREATE.TRIGGER FILENAME SUBNAME UPDATE

how do i use these for real
How do I use these for real?

Hampshire has truckloads of custom code/files

On ALL custom files, I use triggers for

ADD/CHG OPER, DATE, TIME

Why not Envision?

We use triggers on some Datatel files too!

We use WORKORDERS for Phys Plant and IT

PPWP (Web Params) only allows single Plant Type

and single email address for web work orders

No problem – worked around with a trigger

slide7
SUBROUTINE H08.UT.H08.CR.EVENTS(X.EXEC,X.DICT,X.FILE,X.ID,X.REC)

X.EXEC=2

IF X.DICT=’’ THEN

X.REC<4>=UPCASE(@LOGNAME)

X.REC<5>=DATE()

X.REC<6>=TIME()

IF X.REC<1>=’’ THEN

X.REC<1>=X.REC<4>

X.REC<2>=X.REC<5>

X.REC<3>=X.REC<6>

END

END

RETURN

:BASIC CUSTOM.SOURCE H08.UT.H08.CR.EVENTS

:CATALOG CUSTOM.SOURCE H08.UT.H08.CR.EVENTS FORCE

:CREATE.TRIGGER H08.CR.EVENTS H08.UT.H08.CR.EVENTS UPDATE

non trivial examples
Non-trivial examples

Search for HTML tags in free-form text

Strip bad (unprintable) ASCII from free-form text

Correct WORKORDER plant/email

Set billed flag for parking stickers

Detect data irregularities with evaluations (text types)

FMLA check for approved timecards

Why not place this code in screens/batch processes?

where do i find more information
Where do I find more information?

Unidata Documentation (thin):

Developing Unibasic Applications

Chapter 4 – Maintaining Data in Files

Database triggers pp. 4-6

questions
Questions?

Jeff Butera

Hampshire College

jbutera@hampshire.edu

http://jeff.hampshire.edu