What is the workarea alias when a trigger is executed?

When a trigger fires, VFP code is executed. What is the workarea while executing that code?

 

CREATE DATABASE xx

CREATE TABLE temp (name c(10))

CREATE TABLE AnotherTemp (name c(10))

CREATE TRIGGER ON temp FOR INSERT as name !=ShowAlias(ALIAS())

CLOSE DATABASES all

USE temp ALIAS foo

USE temp again ALIAS bar IN 2

USE anothertemp IN 3 ALIAS fred

SELECT fred && select different area

INSERT INTO foo VALUES ("bb")

INSERT INTO bar VALUES ("BAR")      && Trigger Fails

INSERT INTO foo VALUES ("FOO")      && Trigger Fails

 

 

PROCEDURE ShowAlias(cAlias as String) as String

      ?PROGRAM(),cALIAS

      RETURN cALIAS

 

 

From running this code, it’s clear that the Alias is always that of the cursor being updated, regardless of the Alias selected in the code that caused the trigger to fire.

Be careful! The “TEMP” table is actually used twice with 2 different aliases, neither of which is “TEMP”