Hi Gregory!
I use such structure for my own reasons. I have a table which stores information about two types of agreements: main agreements and additional agreements belonging to them. They have similar structure so I keep them in one table with the mark indicating if it is a main agreement or additional agreement.
And I use subclass of a Grid object designed to show information in a tree-form. So I need child records to have some information about parents in order to biuld proper indexes for tree-grid sorting.
The last version of trigger code I tried to use was following:
FUNCTION Update_Index_Tags
IF DogType = 1
lcCurrentAlias = ALLTRIM(ALIAS())
lcParentID = ALLTRIM(Key)
lcAgrNum = ALLTRIM(Agreement_Number)
ldAgrDate = Agreement_Date
lcOwnerName = ALLTRIM(Owner_Name)
lcPayerName = ALLTRIM(Payer_Name)
lcShipName = ALLTRIM(Ship_Name)
lcAliasName = SYS(2015)
USE Agreements AGAIN IN 0 ALIAS (lcAliasName)
SELECT (lcAliasName)
Replace Parent_ANum WITH lcAgrNum, Parent_ADate WITH ldAgrDate,;
Parent_Owner WITH lcOwnerName, Parent_Payer WITH lcPayerName,;
Parent_Ship WITH lcShipName FOR ALLTRIM(Parent) == lcParentID
IN lcAliasName)
USE IN (lcAliasName)
IF !EMPTY(lcCurrentAlias)
SELECT (lcCurrentAlias)
ENDIF
ENDIF
RETURN .t.
ENDFUNC
And it raises error. According to VFP help:
"A rule or trigger code caused the original cursor, the cursor from which the rule or trigger was fired, to try to evaluate a rule or trigger recursively. This can occur under the following conditions:
Attempting to move the record pointer or change values in the original cursor.
Attempting to move the record pointer in the BeforeUpdate event for a CursorAdapter object.
Check your rule or trigger code"
What can I do with this?
Eugene