KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Manipulating Plug-in Area data inside of Triggers
PRODUCT: 4D | VERSION: | PLATFORM:
Published On: December 8, 2000
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

If you wish to perform operations on Plug-in data stored in an Area during the operation of a Trigger, you must create an offscreen area inside the trigger and copy the data from the Picture or BLOB field into the offscreen area. For example, to copy the text of a 4D Write external area into another field inside a trigger use code such as:

Copy and paste the following code into your 4D project:
` Trigger for [MyTable]
C_LONGINT($0)
$0:=0 ` Assume the database request will be granted
Case of
: (Database event=On Saving New Record Event )
` Perform appropriates action for the saving of a newly created record
tempAreaID:=WR New offscreen area
WR BLOB TO AREA (tempAreaID;[MyTable]myWR_BLOB_)
[MyTable]MyTextField:=WR Get text (tempAreaID;0;32000)
WR DELETE OFFSCREEN AREA (tempAreaID)
: (Database event=On Saving Existing Record Event )
` Perform appropriates actions for the saving of an already existing record
tempAreaID:=WR New offscreen area
WR BLOB TO AREA (tempAreaID;[MyTable]myWR_BLOB_)
[MyTable]MyTextField:=WR Get text (myWR_BLOB;0;32000)
WR DELETE OFFSCREEN AREA (tempAreaID)
: (Database event=On Deleting Record Event )
` Perform appropriates actions for the deletion of a record
: (Database event=On Loading Record Event )
` Perform appropriates actions for the loading into memory of a record
End case