Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing parameters to a trigger
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Passing parameters to a trigger
Divers
Thread ID:
00781463
Message ID:
00781463
Vues:
40
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform