1:1 Relationship - retrieval query

Posts   
 
    
Posts: 497
Joined: 08-Apr-2004
# Posted on: 03-Aug-2004 16:34:41   

Hi!

Maybe its the end of the day for my brain, but I am stuck at this hurdle:

I have 2 tables, System_Area, and Site_System.

System_Area contains a list of areas for the system:

Code Title AREA1 Area 1 AREA2 Area 2

These areaas can be enabled or disabled for a particular site, so Site_System denotes which sites have which areas:

SiteID AreaCode 1 AREA1 2 AREA1 2 AREA2

Here site 1 has acces to Area1, wheras site 2 has access to both areas.

Ok, my question: HOw do I get LLBL to give me all areas for a given site?

I'm guessing its my LLBL experience shopwing though here wink

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39943
Joined: 17-Aug-2003
# Posted on: 03-Aug-2004 17:33:33   

That's not a 1:1 relation, Site can have multiple area's wink (at least in your example).

Ok, so you want to filter on Site_System to retrieve rows from System_Area - create a predicate expression which contains a fieldcomparevalue predicate and filter on the Site_System.SiteID you want to retrieve the areas for. - create a RelationCollection (or if you are using Adapter, an IRelationPredicatBucket) and add the relation System_Area - Site_System - create a System_Area entity collection and fill it with the relation collection and filter you're formulated.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 497
Joined: 08-Apr-2004
# Posted on: 04-Aug-2004 09:33:45   

Thats excellent simple_smile Thanks Frans!