Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Nesting error in trigger
Message
From
10/06/2005 01:22:21
Eugene Kolmakov
Millennium Technologies
Vladivostok, Russia
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Nesting error in trigger
Miscellaneous
Thread ID:
01022038
Message ID:
01022038
Views:
69
Hi!

I have a problem. When I change values of a record in the table, I need to update some other child records in the same table. And I want to make it work using trigger. But nesting error is raised on trigger execution. I use the following code:

FUNCTION Update_Child_Fields

IF myTable.Type = 1 && Type = 1 - Parent, Type = 2 - Child

lcParentID = ALLTRIM(myTable.Key)
lcOwnerID = ALLTRIM(myTable.OwnerID)
lcAliasName = SYS(2015)

USE myTable AGAIN IN 0 ALIAS (lcAliasName)

SELECT (lcAliasName)
Replace Parent_OwnerID WITH lcOwnerID;
FOR ALLTRIM(Parent) == lcParentID
IN (lcAliasName)

USE IN (lcAliasName)

ENDIF

ENDFUNC

I call this function in myTable's Update trigger. I have no idea why it doesn't work and how to make it work correctly. Need your help.

P.S. Now I removed all links to MyTable (i.e. Key instead of myTable.Key, etc.). Now it says: "Illegal recursion in rule evaluation". As far as I could understand, trigger can't be fired within itself.
But I need to make it work. How?
Eugene
Next
Reply
Map
View

Click here to load this message in the networking platform