Select where not in

Posts   
 
    
Seanw
User
Posts: 9
Joined: 30-Nov-2005
# Posted on: 14-Dec-2005 03:05:24   

I need to write an adaptor filter that will produce a query like

select table.fielda from table where table.fielda not in ( select fielda from table2 )

and table2 is an item in an entitycollection.

I have read the How do I write a filter which does WHERE field IN (SELECT fieldb FROM foo) ? in the How do I section in the help docs, but the example there does not seem to work.

Sean

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Dec-2005 06:51:35   

Please tell us what code did you use and what exactly was the output. a code snippet would be great.

Also to have the Not IN use the negate parameter in the FieldCompareSetPredicate

You may also check the following thread: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=2435

Seanw
User
Posts: 9
Joined: 30-Nov-2005
# Posted on: 14-Dec-2005 07:36:23   


    Dim filter As New PredicateExpression
        filter.Add(New FieldCompareSetPredicate( _
         entOther.ReponseOtherCode, Nothing, entOther2.ReponseOtherCode, Nothing, _
          Not SetOperator.In, Nothing))


Dont mind the messy code, I am still in POC stage.

The problem is the Visual Studio says that the above (New FieldCompareSetPredicate ) does not have an overload that supports the above.

entOther & entOther2 are both entities.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 14-Dec-2005 08:33:28   

instead of: New FieldCompareSetPredicate( entOther.ReponseOtherCode, Nothing, entOther2.ReponseOtherCode, Nothing, Not SetOperator.In, Nothing))

do: New FieldCompareSetPredicate( entOther.ReponseOtherCode, Nothing, entOther2.ReponseOtherCode, Nothing, SetOperator.In, Nothing, True))

See the reference manual for details.

Frans Bouma | Lead developer LLBLGen Pro