Native Language constructs

Posts   
 
    
Barney
User
Posts: 29
Joined: 27-Jul-2005
# Posted on: 19-Jan-2007 20:38:08   

I am using VS2005 and VB along with version 2.0 of LLBL.

I created a new project and generate the code from my SQL Server DB.

I tried using this code:

        colSavedReports = New SavedReportCollection()
        Dim Filter As IPredicateExpression = New PredicateExpression()
        Filter.Add(Repository.SavedReportFieldIndex.UserID = Functions.User.UserID)
        colSavedReports.GetMulti(Filter)

and I get this error in the designer:

Value of type 'Boolean' cannot be converted to 'SD.LLBLGen.Pro.ORMSupportClasses.IPredicate'.

This error is in the Filter.Add parameter. I am following what I have read in the help file but it's not working. What am I doing wrong?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 20-Jan-2007 01:55:17   

Can you try

Filter.Add(Repository.SavedReportFields.UserID = Functions.User.UserID)

Note the use of SavedReportFields instead of the FieldIndex. Let us know if this helps.

Barney
User
Posts: 29
Joined: 27-Jul-2005
# Posted on: 20-Jan-2007 02:05:06   

I tried that and I receive this error:

'SavedReportFields' is not a member of 'Repository'

I can find no collection of fields to use for this form of creating a predicate. I just have the fieldindex like in version 1.

I created this by opening up a Version 1 lgp file, refreshing the catalog, and regenerating fresh code in a new empty directory. I used the Version 1 lgp file to preserve my typed lists.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 20-Jan-2007 17:54:04   

The *Fields classes are in the <rootnamespace>.HelperClasses namespace, could you please add an Imports statement to the top of the code file which imports that namespace so you can use those classes? Bclubb assumed that Repository is some kind of namespace in your system.

Frans Bouma | Lead developer LLBLGen Pro
jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 20-Jan-2007 18:31:02   

you need 2 equals signs in your predicate, not 1.

colSavedReports = New SavedReportCollection()
Dim Filter As IPredicateExpression = New PredicateExpression()
Filter.Add(Repository.SavedReportFields.UserID == Functions.User.UserID)
colSavedReports.GetMulti(Filter)
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 20-Jan-2007 19:23:29   

jmeckley wrote:

you need 2 equals signs in your predicate, not 1.

colSavedReports = New SavedReportCollection()
Dim Filter As IPredicateExpression = New PredicateExpression()
Filter.Add(Repository.SavedReportFields.UserID == Functions.User.UserID)
colSavedReports.GetMulti(Filter)

The code is VB.NET, which has a single '=' instead of a '==' which is a native C# operator wink

Frans Bouma | Lead developer LLBLGen Pro
Barney
User
Posts: 29
Joined: 27-Jul-2005
# Posted on: 20-Jan-2007 23:49:28   

Yes it's VB so one = works. Thanks, it's working great.

Now I just have to update all my code that creates predicates and does sorting. Shouldn't take too long, I like the new format and I can't wait to try the LLBLGenProDataSource control.