Filters are not easy for the novice

Posts   
 
    
Posts: 11
Joined: 23-Oct-2007
# Posted on: 25-Oct-2007 01:22:55   

Hi

The manual is very unclear on the following, perhaps someone can help me

In the manual... Generated code - Getting started with filtering, SelfServicing Which is found in the documenation -> Using the generated Code -> Self Servicing -> Filtering and Sorting -> Getting started with filtering...

I read the whole article twice... problem is that I still am confused how to simply get a where clause in the predicate....

This is my problem...

The help refers to code samples...

' [VB.NET] .NET 2.0 Dim A As IPredicateExpression = New PredicateExpression() A.Add(Table1Fields.Foo = "One") A.AddWithAnd(Table1Fields.Bar = "Two")

Can someone please explain what Table1Fields is - and of what type.... I have tried to find an object like this that works in a similar way for my entity object...

Thanks

Posts: 11
Joined: 23-Oct-2007
# Posted on: 25-Oct-2007 01:26:19   

Can someone just give me a really good example on how to add a where filter to the results of a GetMultiAsDataTable call ... thanks....

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 25-Oct-2007 05:47:32   

Hi Michael,

Here a sample extracted from LLBLGenPro docs (v2.5):

Dim fields As New ResultsetFields(3)
fields.DefineField(EmployeeFields.FirstName, 0, "FirstNameManager", "Manager")
fields.DefineField(EmployeeFields.LastName, 1, "LastNameManager", "Manager")
fields.DefineField(EmployeeFields.LastName, 2, "AmountEmployees", "Employee", AggregateFunction.Count)
Dim relations As IRelationCollection = New RelationCollection()
relations.Add(EmployeeEntity.Relations.EmployeeEntityUsingEmployeeId, "Employee", "Manager", JoinHint.None)

Dim groupByClause As IGroupByCollection = New GroupByCollection()
groupByClause.Add(fields(0))
groupByClause.Add(fields(1))

Dim dynamicList As New DataTable()
Dim dao As New TypedListDAO()
dao.GetMultiAsDataTable(fields, dynamicList, 0, Nothing, Nothing, relations, True, groupByClause, Nothing, 0, 0)

Here EmployeeFields is a container of Fields that belongs to Employee, so we can add fields to our resulset.

Do you have scpecific questions about above code?

David Elizondo | LLBLGen Support Team
CSharpner
User
Posts: 28
Joined: 03-Jun-2007
# Posted on: 14-Nov-2007 20:45:52   

I think his question was (and even it it wasn't, mine is):

In your sample, you're referring to EmployeeFields.FirstName, etc... Where does this EmployeeFields object come from? I've been searching and searching and I can't find any reference to where this comes from. I don't have any MyTableFields for any entity classes that I can find.

TIA

CSharpner
User
Posts: 28
Joined: 03-Jun-2007
# Posted on: 14-Nov-2007 20:49:03   

Oh give me a break! 30 seconds after I posted the message, I finally figured it out! You have to add:

using MyNameSpaceForMyLLBLGenLayer.HelperClasses;

Jeesh! I hate it when I do that! flushed

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 15-Nov-2007 04:19:03   

It's Ok smile

David Elizondo | LLBLGen Support Team