SELECT DISTINCT query

Posts   
 
    
idrees
User
Posts: 19
Joined: 01-Feb-2007
# Posted on: 02-Feb-2007 06:13:15   

Hi All

The following code is from LLBLGen Pro's documentation that tells us how to do a "select distinct(field).." kind of this using Fill().

OrderCustomerTypedList orderCustomer = new OrderCustomerTypedList();
IPredicateExpression filter = new PredicateExpression(
    PredicateFactory.CompareValue(CustomerFieldIndex.Country, ComparisonOperator.Equal, "Brazil"));
ISortExpression sorter = new SortExpression(
    SortClauseFactory.Create(OrderFieldIndex.Freight, SortOperator.Ascending));
// Set allowDuplicates to true, because we sort on a field that is not in our resultset and we use SqlServer.
orderCustomer.Fill(0, sorter, true, filter);

But I can't find the typelist (QualificationTypedList) class for the entity that I am using (Qualification).

Is there any alternative?

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 02-Feb-2007 08:20:49   

TypedLists are not generated by default. You should define them in the LLBLgen Pro Designer.

Or you may use Dynamic Lists which is directly defined in code.

Pease consult the LLBLGen Pro manual:

1- Using the designer -> Adding typed lists

2- Using the generated code -> SelfServicing/Adapter -> Using TypedViews, TypedLists and Dynamic Lists

_manish
User
Posts: 7
Joined: 27-Feb-2009
# Posted on: 15-Jul-2009 08:25:48   

Suppose my query is :

SELECT DISTINCT Description FROM Table1 WHERE (FKId = 1)

My code of c# is

DataTable listDescription = new DataTable (); IEntityFields2 fields; fields = new EntityFields2(2); fields.DefineField(Table1Fields.Id, 0); fields.DefineField(Table1Fields.Description, 1);

        IRelationPredicateBucket predicate = new RelationPredicateBucket();
        predicate.PredicateExpression.Add(Table1Fields.FKId  == 1);
        predicate.Relations.Add(Table1Entity.Relations.TableFKEntityUsingPackageRespondentId, JoinHint.Left);
        m_adapter.FetchTypedList(fields, listRFQ, predicate,false);

        return listRFQ;

Now the things is how to apply distinct on description ??

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39833
Joined: 17-Aug-2003
# Posted on: 15-Jul-2009 09:56:14   

Manish' question was posted in a separate thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=16288

Frans Bouma | Lead developer LLBLGen Pro