Local lcItemID && The ID of the item for which you && want to retrieve all the linked && items. Local laLinkedItems[1] && Store the ID of the linked items. Local lnLinkedItemCount && The number of items linked. lcItemID = < some item ID > raLinkedItems[1] = '' lnLinkedItemCount = RetrieveLinkedItems(@laLinkedItems, lcItemID) .... Function RetrieveLinkedItems Lparameters raLinkedItems, tcItemsID, tlInitialized Local lnRetVal If Not tlInitialized Then Dimension raLinkedItems[1] raLinkedItems[1] = '' EndIf lnRetVal = 0 If tcItemID is present in your table Locate tcItemID in your table For Each Item lcLinkedID In PointsTo If lcItemID is not already present in array Then If Empty(raLinkedItems[1]) Then raLinkedItems[1] = lcLinkedID Else Dimension raLinkedItems[ALEN(raLinkedItems) + 1] raLinkedItems[ALEN(raLinkedItems)] = lcLinkedID EndIf =RetrieveLinkedItems(@raLinkedItems, lcLinkedID, .T.) EndIf EndFor EndIf If Not tlInitialized Then lnRetVal = Iif(Empty(raLinkedItems[1]), 0, Alen(raLinkedItems)) Else *-- To denote it is a recursive call (you could return the *-- number of items added as an alternative) lnRetVal = -1 EndIf Return ( lnRetVal )Daniel