Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Dynamic Select Distinct
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Oren Eini (Ayende Rahien)  
View profile  
 More options Apr 2 2012, 9:28 pm
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Tue, 3 Apr 2012 04:28:41 +0300
Local: Mon, Apr 2 2012 9:28 pm
Subject: Re: [RavenDB] Dynamic Select Distinct

Don't do that.
Create an index with all of the fields that you are showing.

Then you can use the store.DatabaseCommands.GetTerms() method to get the
distinct terms from the index for a particular field in a very cheap
fashion.

On Tue, Apr 3, 2012 at 4:06 AM, Elbino <chined...@gmail.com> wrote:
> I am building a WPF app that's using RavenDB.

> The app basically launches and shows the data in a DataGrid.

> User's want to be able to filter by grid columns, i.e when they click
> a grid column header, I want to display in a drop down list all the
> distinct values for that column.

> The data is stored in strong typed objects.
> currently I create a map-reduce index to select dictinc for each
> column

> public class QzBookIndex : AbstractIndexCreationTask<VmDto>
>    {
>        public QzBookIndex()
>        {
>            Map = qzList => from qzObj in qzList
>                            select new { qzObj.Book };

>            Reduce = results => from result in results
>                                group result by result.Book into g
>                                select new { Book = g.Key };
>        }

>    }

> then in the filter method I query using the index:
>  var items = (from item in docSession.Query<VMDto, QzBookIndex>()
>                             select item.CobDate);

> All works Fine.  But I need to make the index and the select statement
> dynamic.

> i.e. when the user clicks the header for a particular column in the
> grid for the first time, I want to create an index for that property
> and then dynamically select all the distinct values for that property
> and display them in the dropdown list...

> I might be aproaching this the wrong way. but the gist of what I want
> is in the paragraph above


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.