filtered Dynamic List

Posts   
 
    
jjnies
User
Posts: 66
Joined: 07-Nov-2007
# Posted on: 19-May-2008 21:47:51   

Hello all, I'm having problems with filtering a dynamic list. I'm probably doing something overlookable.



            Dim fields As New ResultsetFields(4)
            fields.DefineField(DocumentFieldIndex.Id, 0, "ID", "Document")
            fields.DefineField(DocumentFieldIndex.Name, 1, "Name", "Document")
            fields.DefineField(DocumentFieldIndex.CreatedDate, 2, "CreatedDate", "Document")
            fields.DefineField(DocumentFieldIndex.Location, 3, "Location", "Document")

            Dim filter As New PredicateExpression()
            filter.Add(XavierDAL.HelperClasses.DocumentFields.Location = DocumentLibrary.Id)

            Dim dynamicList As New Data.DataTable()
            Dim dao As New DaoClasses.TypedListDAO()

            dao.GetMultiAsDataTable(fields, dynamicList, 0, Nothing, filter, Nothing, True, Nothing, Nothing, 0, 0)


when I leave the filter in I get this error:

The multi-part identifier "Xavier.dbo.Document.Location" could not be bound.

When I leave the filter out it works great. What am I doing wrong in the PredicateExpression? thanks!

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 20-May-2008 04:14:40   

Hi jinies.

As you are specifying object aliases, you should specify the alias in the filter as well:

filter.Add(XavierDAL.HelperClasses.DocumentFields.Location.SetObjectAlias("Document") = DocumentLibrary.Id)
David Elizondo | LLBLGen Support Team
jjnies
User
Posts: 66
Joined: 07-Nov-2007
# Posted on: 21-May-2008 21:05:11   

daelmo wrote:

Hi jinies.

As you are specifying object aliases, you should specify the alias in the filter as well:

filter.Add(XavierDAL.HelperClasses.DocumentFields.Location.SetObjectAlias("Document") = DocumentLibrary.Id)

thanks man, it worked!