Filtering Predicates

Posts   
 
    
cmprogrock
User
Posts: 40
Joined: 16-Nov-2008
# Posted on: 14-May-2009 02:58:53   

Hi, I'm trying to fiter a collection. Using the example in Docs.

Example:

A.Add(Table1Fields.Foo == "One"); A.AddWithAnd(Table1Fields.Bar == "Two");

Problem:

I have no reference to any 'TableFields' So No..Table1Fields.Foo

Tryed ....AppUser.UserID == 10...no luck Tryed ..."AppUser.UserID== 10...no luck Tryed...."UserID==10" ... no luck

Whats up?

Video WalkThrough: http://www.screencast.com/users/chris.m/folders/Jing/media/2614a26d-d5df-46df-88e7-fca5640a5367

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 14-May-2009 03:30:55   

Hi there -

Please include/import YourDataObjects.HelperClasses

So, include devAppBreader.HelperClasses. Then use ABAppFields.AppTypeID = 1

Hope this helps!

Ryan

cmprogrock
User
Posts: 40
Joined: 16-Nov-2008
# Posted on: 14-May-2009 03:55:13   

Right - I got that now. Thanks Man!

The next issue...How do I fire off this filter....

Here's the Example.

I have a User...with a Colletion of 'Apps' (MyUser.Apps)

I want to filter it so I only get this User's Apps of AppType == 1 (I'd hope to write... MyUser.Apps.Filter(AppsFields.AppType == 1))

Not that simple!

So I now have a good Predicate...A.Add(devAppBreader.HelperClasses.AbappFields.AppTypeId == 1);

How do I fire it against my Users Apps Collection?

Video WalkThrough: http://www.screencast.com/users/chris.m/folders/Jing/media/4a6ab45c-e892-401e-968d-c294f7ae1668

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 14-May-2009 04:23:55   

In-Memory Filtering is done with EntityViews. This should be about right (don't have VisualStudio open):

Dim myView as EntityView(Of AppEntity) = myUser.Apps.DefaultView

myView.Filter = New PredicateExpression(AppFields.AppTypeID = 1)

For Each myApp as AppEntity in myView

Next

Hope this helps!

Ryan

cmprogrock
User
Posts: 40
Joined: 16-Nov-2008
# Posted on: 14-May-2009 05:02:16   

Nice work Ryann!. Thanks a bunch...the docs are so verbose.

The thing worked.

Cheers to Green Bay!

Thanks Man

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 14-May-2009 05:52:22   

You're very welcome!

It takes some time to sit down with the docs. But rest assured - you're using the very best ORM Framework for Microsoft .NET. Once you get the hang of it (which I'm sure you will very soon)... you can do anything with it pretty easily; it is extremely powerful... and can scale to whatever your application size. The support here on these forums is excellent. It's great being able to speak directly with Frans, the Architect, (if need be) or directly with his Support Team without any big-organization/bureaucracy redtape.

When I started, I actually printed the entire help manual you have there and basically read it cover-to-cover. The important stuff, anyway. Frans - thanks for all your hard work!

Can't say enough about LLBLGen Pro. I recommend it to everyone.

Love the screencasts by the way. Jing sits in my system tray as well. sunglasses

Ryan

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 14-May-2009 11:05:07   

Ryan, On Behalf of LLBLGen Pro team I have to thank for your very positive words.

Good Luck and have fun using LLBLGen Pro. simple_smile