TDL for self joins

Posts   
 
    
omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 23-Mar-2007 15:01:58   

Consider the Employees table from SQL server's Northwind sample database. This table has a self JOIN on the ReportsTo field. If I generate a standard adapter DAL for this database, the table would have TWO relations EmployeesEntityUsingEmployeeIDReportsTo and EmployeesEntityUsingReportsTo

In DbCount computations where I want number of employees that report to a known employeeId, I should use the (EmployeesEntityUsingEmployeeIDReportsTo ) relation and the (ReportsTo) field in the filterBucket I would build for this cmputation.

If I want to write a TDL template, I know that I have to use <[Foreach RelatedEntity OneToMany]><[If Not MappedFieldRelationIsHidden]> but then how can I know that the relation is a self join relation inside this loop?

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 23-Mar-2007 15:28:56   

<[If Not RelatedEntityIsOtherEntity]> ... <[EndIf]>

omar avatar
omar
User
Posts: 569
Joined: 15-Oct-2004
# Posted on: 23-Mar-2007 19:05:53   

Thanx Walaa.. is that one in the SDK docs.. I will try it now simple_smile

Walaa avatar
Walaa
Support Team
Posts: 14987
Joined: 21-Aug-2005
# Posted on: 26-Mar-2007 08:31:58   

It is in the SDK docs.