How to use predicate logic

Posts   
 
    
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 17-Jan-2008 00:44:57   

Greetings,

I am new to trying more advanced filtering with the predicate logic. Can anyone help me translate this query into predicate logic:

select * from a where not exists (select 1 from b where b.key=a.key)

(or achieve the same goal which is selecting all rows from an entity that are not related to by another entity).

Thanks!

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Jan-2008 04:02:01   

Hi scotru,

In this case you should go on "FieldCompareSetPredicate". There are a bunch of information at forums. Also review the LLBLGenPro Help.

Are you using SelfServicing or Adapter?

David Elizondo | LLBLGen Support Team
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 17-Jan-2008 08:22:21   

Thanks--I'll take a look at that. Self-Servicing.

scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 17-Jan-2008 09:49:13   

Was able to accomplish what I wanted with:

            IPredicateExpression selectFilter = new PredicateExpression();
            selectFilter.Add(new FieldCompareSetPredicate(MailboxesFields.MailboxId, RoomsFields.MailboxId, SetOperator.NotEqualAny,(RoomsFields.MailboxId != DBNull.Value),false));
            selectFilter.AddWithAnd(MailboxesFields.BuildingId == building.BuildingId);
                mailboxes.GetMulti(selectFilter);

with reference to this thread:

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=6202

Thanks for your help!