How to get Distinct rows from a table

Posts   
 
    
Subbu avatar
Subbu
User
Posts: 13
Joined: 02-Mar-2006
# Posted on: 03-Mar-2006 10:02:24   

Hi, I have a table with 3 fields 1 Primary key and the rest are strings. This string field may get values repeated. Can anyone help me to get the distinct values of these fields using LLBLGen. This help would be appreciated

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 03-Mar-2006 10:54:38   

Use a dynamic list or a typed list and specify when you fetch it that allowduplicates should be false. See in the documentation: Using the generated code -> Selfservicing/adapter -> Using views and lists -> Using dynamic lists (or usign the typedlist classes).

Dynamic lists are lists of entity fields you can create in code and which are fetched into a datatable. If you want to read entities from that table, you always get unique objects, as explained to you in the other thread about this same topic simple_smile

The thing is though: what exactly do you want to achieve? Because if you want to read distinct rows, the PK will always be unique in every row, so you won't get distinct string values. If you just want all distinct values of 1 column in that table, you can use a typedlist or dynamic list as described above to do that.

Frans Bouma | Lead developer LLBLGen Pro