Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing parameters to a trigger
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Passing parameters to a trigger
Miscellaneous
Thread ID:
00781463
Message ID:
00781463
Views:
41
I have a table (part) with a trigger that creates transactions (parttran) for qty changes on a part record. The transactions types could be created from a variety of sources. One transaction type could be MANUAL ADJUSTMENT another could be BACKFLUSH and another PHYSICAL INVENTORY. How can I pass the transaction type to the trigger so that it gets written to the parttran record?
It almost seems as if I would have to write the transaction type to the part table.

Parttran.cdesc is where I want the transaction type to go.

Here is my part update, insert and delete trigger.
PROCEDURE CreatePartTran(cMode)
 DO CASE
  CASE cMode='U'  && update
   IF part.nonhand <> OLDVAL('nonhand','part') then
     INSERT INTO parttran(ntrannum,cuserid,tdatetime,cpartnum,nqty,cdesc) ;
       VALUES (newpk('parttran'),oWFUser.cuserid,DATETIME(),;
          part.cpartnum,part.nonhand-OLDVAL('nonhand','part'),'')
   ENDIF
  CASE cMode='I'  && insert
   INSERT INTO parttran(ntrannum,cuserid,tdatetime,cpartnum,nqty,cdesc) ;
     VALUES (newpk('parttran'),oWFUser.cuserid,DATETIME(),; 
        part.cpartnum,part.nonhand,'')
  CASE cMode='D' && delete
 ENDCASE
ENDPROC
Next
Reply
Map
View

Click here to load this message in the networking platform