Select distinct values by using self servicing template

Posts   
 
    
abdo
User
Posts: 10
Joined: 23-Feb-2009
# Posted on: 15-Apr-2009 22:00:20   

Hi Team,

How can i select distinct records by using self servicing template

Thanks and Regards.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Apr-2009 03:11:57   

Could you please elaborate more? Are you fetching a EntityCollection, a TypedView or a TypedList? In general a EntityCollection fetch is a distinct fetch because the nature of the entities.

David Elizondo | LLBLGen Support Team
abdo
User
Posts: 10
Joined: 23-Feb-2009
# Posted on: 16-Apr-2009 08:56:06   

yes, I'm using EntityCollection GeMulti function, but I need to get distinct entities based on specified column in DB.

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 16-Apr-2009 11:30:19   

DISTINCT is applied to all fields in the select list. So when fetching an entityCollection (fetching all fields of the entity), the framework makes sure you get back a distinct resultset. Regarding the entire select list of fields.

For your case I'll need you to post the SQL query you want to execute, to help you implement it with LLBLGen Pro.

Krish
User
Posts: 91
Joined: 02-Jan-2008
# Posted on: 16-Jun-2009 09:22:26   

I have a similar issue, so I thought I will write it here rather than starting a new thread.

I want to do something similar to : Select distinct ColC from tableA.

tableA structure is:

ColA - Auto sequence and PK. ColB - varchar 50 ColC - varchar 50 ColD - varchar 50

ColB and ColC form unique key constraint.

How do you do this in llblgen. Appreciate the simplest answer.

I am using llblgen pro 2.6 final. self servicing two class template. C#.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 16-Jun-2009 09:50:40   

Use a dynamicList to fetch that one column, and pass false to the allowDuplicates parameter of the dao.GetMultiAsDataTable() method.

You can find an example here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14345