Hi Polutan,

I don't know the full context of your problem. But I think you should be able 
to do something like this:
Create a view with a map:

function (doc) {
        var t = new Date(doc['dateOfEntry');
        emit([doc.accountName, t.getFullYear(), t.getMonth(), t.getDay()], 1);
}

You would most likely have to create some if clauses to check the doc has all 
these values.

When you query the view you use the following parameters: 
start_key = ["MyAccountName", 2013,1,1 ] - Change the date to be the start of 
time range that you want your data for.
end_key = ["MyAccountName", 2013,12,31] - Again change the date range to suit 
your needs
include_docs = true - so you get the docs.

This should give you all the docs for your account in the specific date range.

Cheers
Garren


On 28 May 2013, at 5:49 PM, polutan <[email protected]> wrote:

> @Garren
> Hi Garren :) thank you for your reply.
> But i still don't understand with your explanation. Please give me an
> example. I don't understand with ur statement " emit that date range as
> well as the account number" .
> 
> Thank You :)
> 
> 
> 2013/5/22 Garren Smith <[email protected]>
> 
>> Hi Polutan,
>> 
>> I think you could get what you want by just using one view. For your view
>> keys emit that date range as well as the account number. Then when you do a
>> query of the data include the date range as well as the account number that
>> you want this data for. Couchdb will then return the balance sheet entries
>> for that date range belonging to your account number.
>> 
>> Cheers
>> Garren
>> 
>> On 22 May 2013, at 11:39 AM, polutan <[email protected]> wrote:
>> 
>>> What??? I can't believe it :(
>>> So. any other alternative for my case?
>>> 
>>> Thank You :)
>>> 
>>> 
>>> 2013/5/22 Dave Cottlehuber <[email protected]>
>>> 
>>>> On 22 May 2013 09:37, Andrey Kuprianov <[email protected]>
>>>> wrote:
>>>>> Hi,
>>>>> 
>>>>> There's a 1st edition available, as opposed to reading a draft:
>>>>> http://guide.couchdb.org/editions/1/en/index.html
>>>>> 
>>>>> Andrey
>>>> 
>>>> The draft ironically is the newer 1.x release edition. Confusing!
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> *Coklat Stroberi -- Web Dev Training Centre*
>>> http://www.facebook.com/pages/Coklat-Stroberi/249514251728226  (info
>> lebih
>>> lanjut)
>>> http://coklatstroberi.net
>>> Jl. Raya Padang Luwih (Dalung) No.141 - Telp. (0361) 9006118 atau
>>> 08174128301 - Badung, Bali. Sebelah timur traffic light pertigaan
>> perumahan
>>> dalung permai.
>> 
>> 
> 
> 
> -- 
> *Coklat Stroberi -- Web Dev Training Centre*
> http://www.facebook.com/pages/Coklat-Stroberi/249514251728226  (info lebih
> lanjut)
> http://coklatstroberi.net
> Jl. Raya Padang Luwih (Dalung) No.141 - Telp. (0361) 9006118 atau
> 08174128301 - Badung, Bali. Sebelah timur traffic light pertigaan perumahan
> dalung permai.

Reply via email to