Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> Converting Query to LLBLGen
 

Pages: 1
Bugs & Issues
Converting Query to LLBLGen
Page:1/1 

  Print all messages in this thread  
Poster Message
pandu
User



Location:

Joined on:
18-May-2006 07:20:06
Posted:
86 posts
# Posted on: 17-Jan-2008 15:57:55.  
Hi:

How do I convert this query to LLBLGen:

select * from qheader where status=2 and
    qnumber in (select qnumber from qsupplier where supplierid= 'ABC' ) and
    qnumber not in (select qnumber from qbid where supplierid= 'ABC' )

The problem is one query using IN and another one is using NOT IN.

Any help is appreciated.

Thanks.

  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 18-Jan-2008 08:38:45.  
Use 2 insatances of FieldCompareSetPredicate, and specify true for the negate parameter for the NOT IN one.

  Top
pandu
User



Location:

Joined on:
18-May-2006 07:20:06
Posted:
86 posts
# Posted on: 18-Jan-2008 09:03:20.  
We use FieldCompareRangePredicate and here is the code:

Code:
Dim values1 As New ArrayList()
Dim i As Integer
For i = 0 To 10
     values1.Add(i)
Next
Dim bucketRelation As IRelationPredicateBucket = New RelationPredicateBucket()
bucketRelation.PredicateExpression.AddWithAnd(New FieldCompareRangePredicate(qheaderFields.qnumber, False, values1))


In the last line of this code we get the error as following

Code:

Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:

    'Public Sub New(field As SD.LLBLGen.Pro.ORMSupportClasses.IEntityField, negate As Boolean, ParamArray values() As Object)': Argument matching parameter 'field' narrows from 'SD.LLBLGen.Pro.ORMSupportClasses.EntityField2' to 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityField'.

    'Public Sub New(field As SD.LLBLGen.Pro.ORMSupportClasses.IEntityField, objectAlias As String, ParamArray values() As Object)': Argument matching parameter 'field' narrows from 'SD.LLBLGen.Pro.ORMSupportClasses.EntityField2' to 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityField'.

    'Public Sub New(field As SD.LLBLGen.Pro.ORMSupportClasses.IEntityField, objectAlias As String, ParamArray values() As Object)': Argument matching parameter 'objectAlias' narrows from 'Boolean' to 'String'.

    'Public Sub New(field As SD.LLBLGen.Pro.ORMSupportClasses.IEntityField, ParamArray values() As Object)': Argument matching parameter 'field' narrows from 'SD.LLBLGen.Pro.ORMSupportClasses.EntityField2' to 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityField'.    


We have similar error when we use FieldCompareSetPredicate.

If we set negate to the bucketrelation as a second step like bucketRelation.negat=true, it works but it applies the negate to both conditions.

What am I missing?

I am running with LLBLGen 2.0 with Adapter.

Thanks.
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 18-Jan-2008 09:24:30.  
Please check the LLBLGen Pro Reference manual, for all possible overloads of the CTors of these predicates, as you are using the SelfServicing overloads rather than the Adapter ones.
For example your code should have been:

Dim values1 As New ArrayList()
Dim i As Integer
For i = 0 To 10
     values1.Add(i)
Next
Dim bucketRelation As IRelationPredicateBucket = New RelationPredicateBucket()
bucketRelation.PredicateExpression.AddWithAnd(New FieldCompareRangePredicate(qheaderFields.qnumber, Nothing, False, values1))


  Top
pandu
User



Location:

Joined on:
18-May-2006 07:20:06
Posted:
86 posts
# Posted on: 19-Jan-2008 08:15:12.  
It worked great.

Thanks Walaa. Laugh
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.