Within XIA Configuration Server, it is possible to store items within customers which behave in a similar way to a standard container.




To determine which customer an item belongs to, the GetItemParentCustomerName and GetItemParentCustomerID functions can be used.


  • If multiple customers are nested within each other, the most immediate customer in the hierarchy is returned.

  • When running GetItemParentCustomerID, if the item has no parent customer, zero is returned.

  • When running GetItemParentCustomerName, if the item has no parent customer, an empty string is returned.



The following example returns the unique identifier and name of each item's parent customer where a parent customer is available


SELECT 

  [ItemCore].[ItemID] AS [Item ID],

  [ItemCore].[Name] AS [Item Name],

  [ItemCore].[Description] AS [Description],

  dbo.GetItemParentCustomerID(ItemID) AS [Parent Customer ID],

  dbo.GetItemParentCustomerName(ItemID) AS [Parent Customer Name]

FROM 

  ItemCore

WHERE 

  ItemDeletedDate IS NULL

  AND

  dbo.GetItemParentCustomerID([ItemCore].[ItemID]) <> 0