Filter TypedList with aliases

Posts   
 
    
Sokon1
User
Posts: 97
Joined: 17-Jul-2006
# Posted on: 21-Mar-2007 14:39:38   

Hi,

I modelled the following TypedList with the Designer (letters are entity types): A1 : B -> B : A2 -> A2 : C -> C : D

In the designer I had to alias the entity type A (-> A1, A2). That's ok. Now I want to fill my typed list with the .Fill(...) command and use a predicate expression: I want to filter D and A1. I named the A1-field i wanted as a filter criteria "FieldAlias"


MyTypedList myList = new MyTypedList ();
IPredicateExpression predExpr = new PredicateExpression();

predExpr.Add(dFields.someField == true);    // this works
predExpr.Add(aFields.anotherField.SetObjectAlias("FieldAlias") == somevalue); 

myList.Fill(0, null, false, predExpr);

The Fill command returns an error which says "no such alias or table name 'FieldAlias'"

What's wrong? How can I filter an typed list with aliases? perhaps someone has some example code? Thanks for your answers!

using v2.0.0.0, Feb 14th 2007, selfservicing, C#, SQLServer, .NET2.0

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 21-Mar-2007 15:22:21   

Would you please post the generated query?

Sokon1
User
Posts: 97
Joined: 17-Jul-2006
# Posted on: 21-Mar-2007 16:00:08   

Walaa, thanks again for your quick response - but there's no need anymore. I figured it out by myself. It's always the same: You try to solve a problem for hours and then you decide to write a post. After that the solution comes immidiately by itself!rage

The solution was to use the alias for the ENTITY as "FieldAlias" and not the FIELD ALIAS (you can set both in the designer and i used the wrong one)