How do I create a join based on data?

Posts   
 
    
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 11-Jul-2005 15:24:10   

Is it possible to create a relation based on data?

If I have for example a project and a contract for that project And my project has a start date and an end date.

And I would like to get all the projects with a left join on contract when the join is based on:

left outer join CONTRACT ON PROJECT.PROJECT_NO = CONTRACT_PROJECT_NO AND CONTRACT.ACTIVE_FROM >= PROJECT.START_DATE AND CONTRACT.ACTIVE_UNTIL <= PROJECT.END_DATE

Since I can't do this in the designer, is it possible to do this in code?

I need to do this with a join, because when I use a where clause, i would get different results that I can't use in my application.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 11-Jul-2005 15:59:34   

Yes, specify a predicate expression as CustomFilter, when you add the relation to the relationcollection. Please see Using the generated code / adapter(selfservicing) / filtering and sorting -> Custom filters for EntityRelations

Frans Bouma | Lead developer LLBLGen Pro
caseyry
User
Posts: 79
Joined: 25-Feb-2005
# Posted on: 14-Jul-2005 03:43:14   

Otis wrote:

Yes, specify a predicate expression as CustomFilter, when you add the relation to the relationcollection. Please see Using the generated code / adapter(selfservicing) / filtering and sorting -> Custom filters for EntityRelations

Is it possible specify a CustomFilter for TypedList's relation? Or should I generate a dynamic list instead and pass in the relations with a custom filter?

Thanks, -Ryan Casey

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Jul-2005 09:50:32   

In selfservicing you have to inherit a class from the typedlist class and override BuildRelationSet and first call the base method, then set the particular relation's CustomFilter property (relationCollection[index].CustomFilter = ...) . In adapter you first call typedList.GetRelationInfo(), and the bucket you receive contains the relationcollection: bucket.Relations[index].CustomFilter = ... should do the trick simple_smile

Frans Bouma | Lead developer LLBLGen Pro