1 / 12

Session 4718

Session 4718. Triggers Unlimited National Harbor 6 & 7 Tuesday 4/07/2009 3:45pm Jeff Butera -- Hampshire College Pieter Crow -- Central Wyoming College. Outline. What is a trigger? What can triggers do? How do you setup triggers? Trigger examples Tips and tricks Questions.

nitsa
Download Presentation

Session 4718

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Session 4718 Triggers Unlimited National Harbor 6 & 7 Tuesday 4/07/2009 3:45pm Jeff Butera -- Hampshire College Pieter Crow -- Central Wyoming College

  2. Outline • What is a trigger? • What can triggers do? • How do you setup triggers? • Trigger examples • Tips and tricks • Questions

  3. What is a trigger? • Piece of executed code • Triggered by certain events Unidata specifics: • Code is a Unibasic subroutine or function • Trigger can be invoked when a record is • Created • Modified (written) • Deleted

  4. 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

  5. How do you setup triggers? • Create subroutine with 5 arguments: EXECSTAT out (0,1,2) DICT.FLAG in (“”,“DICT”) FILENAME in (“STUDENTS”) ID in (“0023450”) RECORD in/out • Compile and GLOBALLY catalog • CREATE.TRIGGER FILENAME SUBNAME UPDATE

  6. Trigger examples at Hampshire • Find bad HTML in course descriptions • Edit A/R to NOT show dorm assignment • FMLA check on complete timecard • Log deletes, cleanup pointers • Auto assign ID Card type (& export) • Validate data entered • Stored computed columns (realtime)

  7. Jeff’s tips and tricks * cleanup some simple HTML SWAP '<p>' WITH '<P>' IN X.DESC SWAP '</p>' WITH '</P>' IN X.DESC SWAP '<br>' WITH '<BR/>' IN X.DESC SWAP '<BR>' WITH '<BR/>' IN X.DESC SWAP '<hr>' WITH '<HR/>' IN X.DESC SWAP '<HR>' WITH '<HR/>' IN X.DESC SWAP '</a>' WITH '</A>' IN X.DESC SWAP '<a href' WITH '<A HREF' IN X.DESC SWAP '<a HREF' WITH '<A HREF' IN X.DESC * Strip out some bad binary multibyte chars CALL H08.IC.S.FIX.BAD.ASCII.CHARS(X.DESC)

  8. Trigger examples at Central Wyoming

  9. Pieter’s tips and tricks

  10. More information • Unidata documentation (a little thin): • Developing Unibasic Applications Chapter 4 – Maintaining Data in Files Section on database triggers

  11. Questions Jeff Butera jeff@hampshire.edu http://jeff.hampshire.edu Pieter Crow pcrow@cwc.edu

More Related