filter typed list

Posts   
 
    
laetitia
User
Posts: 5
Joined: 03-Jul-2007
# Posted on: 03-Jul-2007 18:19:03   

Hello, I'd like to create a typed list. The query in sql would be something like: select p.pin, p.forename, p.surname,c.country from person.p left join c.country on p.countryid=c.coutnryid and c.activeind=0 where p.activeind=0

My code so far is dim fields as new ResultsetFields(4) dim filter as RelationPredicateBucket

fields.DefineFields(PersonFieldIndex.pin,0,"Pin","Person") fields.DefineFields(PersonFieldIndex.forename,1,"Forename","Person") fields.DefineFields(PersonFieldIndex.surname,2,"Surname","Person") fields.DefineFields(CountryFieldIndex.coountry,3,"Country","Country")

filter.Relations.Add(PersonEntity.Relations.CountryEntityUsingCountryid,JoinHint.Left) filter.PredicateExpression.Add(PredicateFactory.CompareValue(PersonFieldIndex.activeind,ComparisonOperator.Equal,0))

This works fine except it does not join my table with c.activeind=0. How would I do it? L

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Jul-2007 09:34:41   

Obtain the added EntityRelation as Follows:

EntityRelation relation = filter.Relations.Add(PersonEntity.Relations.CountryEntityUsingCountryid,JoinHint.Left)

Then add the filter to the relation.CustomFilter property.

laetitia
User
Posts: 5
Joined: 03-Jul-2007
# Posted on: 04-Jul-2007 11:39:43   

Thank you very much. It is indeed working perfectly fine now. Laetitia