Identity Manager

Select with Distinct in API

Hi,

How would I add a 'Distinct' to the following code, as in 'Select Distinct LastName from Person'.

Dim aQuery As Query = Query.From(Table.Person).Select("Lastname")
Dim iPersons = Session.Source.GetCollection(aQuery)

thanks,

Rob.

Parents
No Data
Reply
  • This should do the trick.

    Dim aQuery As Query = Query.From(Table.Person).Select(Table.Person.LastName)
    Dim iPersons = Session.Source.GetCollection(Of Person)(aQuery).Distinct(Function(t) t.LastName)

    I saw you used some of the typed entity wrapper goodies so I did this myself as well.

    HTH

Children
No Data