[FIXED] Can't Get Desired Typed List Relations

Posts   
 
    
DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 15-Jun-2004 17:11:09   

I have tables with the following relationships:

Customer Setting User.CustomerID UserSetting.{UserID,SettingID} DefaultSetting.{CustomerID,SettingID}

I am trying to create a typed list to join UserSetting, DefaultSetting, and Setting, using weak relations, to represent a union of all possible SettingIDs. In other words:

Setting LEFT JOIN UserSetting ON Setting.SettingID=UserSetting.SettingID LEFT JOIN User ON UserSetting.UserID=User.UserID LEFT JOIN DefaultSetting ON User.CustomerID=DefaultSetting.CustomerID AND Setting.SettingID=DefaultSetting.SettingID

The problem is, no matter what order I add the tables to the typed list, it will only join DefaultSetting to Setting via SettingID; it will not allow me to specify that DefaultSetting should be joined to User as well.

I have a feeling that this query is too complex to be handled with a typed list, so as a workaround I plan to use two different typed lists to retrieve DefaultSettings separately from UserSettings. However, I was curious if I was overlooking something in LLBLGen that would allow me to do what I am after.

Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 15-Jun-2004 17:18:19   

This may sound like a stupid question but what is the difference between using a TypedList versus a TypedView?

Thanks,

Fishy

Trig
User
Posts: 96
Joined: 09-Jun-2004
# Posted on: 15-Jun-2004 17:29:06   

Typed lists are kind of an ad hoc way of creating a view in the LLBLGen designer whereas Typed Views pull a specific view from the database.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 15-Jun-2004 17:40:46   

It is possible only in Adapter and also not in the gui. SelfServicing has its BuildRelationSet routine marked private, which is changed very soon in the gui update release.

the relations shown in the GUI are the relations used to group the entities together, i.e. the relations generated into the code.

You need to specify a custom filter for the relation. This can be done by overriding the GetRelationInfo method in a subclass of your typed list class. See the adding of a custom filter to a relation the section: 'Using the generated code - SelfServicing/Adapter - Filtering and sorting - Custom filters for relations'.

Another workaround would be to add a view to the db and a typed view to the project. That's more efficient than the workaround you suggested I think.

Frans Bouma | Lead developer LLBLGen Pro
DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 15-Jun-2004 20:37:34   

I thought of deriving a class but couldn't override BuildRelationSet(). I didn't realize GetRelationInfo() was a viable alternative.

Nevertheless, Fishy's post opened my eyes to the possibility of using a TypedView, so I will go that route instead.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 15-Jun-2004 21:39:58   

DaveR wrote:

I thought of deriving a class but couldn't override BuildRelationSet(). I didn't realize GetRelationInfo() was a viable alternative.

GetRelationInfo is in adapter, BuildRelationSet is in SelfServicing, so if your project is build around selfservicing, you can't use hte adapter method obviously simple_smile

The method is made public in hte next revision of the gui/templates which is scheduled for release later this week.

Nevertheless, Fishy's post opened my eyes to the possibility of using a TypedView, so I will go that route instead.

A view would be a good option indeed.

Frans Bouma | Lead developer LLBLGen Pro
DaveR
User
Posts: 43
Joined: 15-Jun-2004
# Posted on: 16-Jun-2004 16:15:40   

Otis wrote:

GetRelationInfo is in adapter, BuildRelationSet is in SelfServicing

I am using Adapter, and my typed list class has both methods: private BuildRelationSet() constructs _filterBucket while GetRelationInfo() simply returns it. Are you saying that BuildRelationSet() is never called in Adapter mode?

I've solved my problem using a view, but I'm curious about this...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 16-Jun-2004 16:26:46   

DaveR wrote:

Otis wrote:

GetRelationInfo is in adapter, BuildRelationSet is in SelfServicing

I am using Adapter, and my typed list class has both methods: private BuildRelationSet() constructs _filterBucket while GetRelationInfo() simply returns it. Are you saying that BuildRelationSet() is never called in Adapter mode?

I've solved my problem using a view, but I'm curious about this...

BuildRelationSet is a private method called by GetRelationInfo. You need GetRelationInfo, as that one produces the object you want to alter and that one is virtual public simple_smile

Frans Bouma | Lead developer LLBLGen Pro