Result from dynamicList is not DISTINCT

Posts   
 
    
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 28-Jun-2007 12:01:36   

Hi,

I have a table Metadata and a table Project. Metadata is connected via 1:m to Project, so one Project can have 1 metadata value.

I try to fill a dynamic list. This is what i have done:

Define to fields: ID and ValueText:

ResultsetFields fields = new ResultsetFields(2); fields.DefineField(MetadataFields.Id, 0); fields.DefineField(MetadataFields.ValueText, 1);

Define the relation between metadata and project:

IRelationPredicateBucket bucket = new RelationPredicateBucket(); bucket.Relations.Add(ProjectEntity.Relations.MetadataEntityUsingStrategicCoreAreaId, JoinHint.Inner);

I add one predicate expression and a sorter:

bucket.PredicateExpression.Add(MetadataFields.Visible == 1); SortExpression sorter = new SortExpression(MetadataFields.OrderNo | SortOperator.Ascending);

And then I fill the list:

adapter.FetchTypedList(fields, dynamicList, bucket, 0, sorter, false);

As you can see I did say false to allowduplicaties

But still my result is : 14, 15, 15, 17 for id's ... ValueText is of course also the same.

Can someone tell me what I am doing wrong here?

Best regards,

  • G.I.
G.I.
User
Posts: 172
Joined: 09-Jun-2005
# Posted on: 28-Jun-2007 12:29:04   

Ok ... forget this one ... I forgot it's not possible to sort by a column in a distinct query if that column is not in de select list.

So obviously LLBLGen generates a normal query without the DISTINCT because of the sortexpression. wink

Now I have just added the field that is sorted by in the dynamiclist ... now I have one unnecessary column, but I do get the results I need.