couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick North <nort...@gmail.com>
Subject Re: [ASK] How to passing 1st view data to 2nd view??
Date Sat, 01 Jun 2013 19:17:58 GMT
There is a discussion of why transactions are not necessary at http://guide.couchdb.org/draft/recipes.html.

Nick

On 1 Jun 2013, at 19:59, Robert Newson <robert.newson@gmail.com> wrote:

> Document updates are atomic.
> On 1 Jun 2013 18:12, "Brad Rhoads" <bdrhoa@gmail.com> wrote:
> 
>> You dont have atomic transactions in couchdb. So it might not be the right
>> db for an accounting app.
>> On May 21, 2013 11:53 PM, "polutan" <linspirell@gmail.com> wrote:
>> 
>>> Hello Folks :)
>>> 
>>> I learn to make a very simple accounting app using CouchDB as my data
>>> storage.
>>> I need to create balance sheet report, and certainly the report must be
>>> able to show by date periode
>>> (example: from 2013-01-01 unti 2013-0131) . My plan is create two view.
>> And
>>> i will doing query 2 times.
>>> The 1st view will give me data filtered by date range. The 2nd view will
>>> filter data from 1st view by account number range.
>>> So.. i need to know, how to passing 1st view data to 2nd view?
>>> 
>>> Ok, what i've done so far is created two view with two different key
>>> arrangement.
>>> My 1st view http://easycaptures.com/fs/uploaded/641/0865962213.png named
>>> journal_date_acc which is
>>> having date-accountNumber key arrangement. ["2013/05/14", 1000, 1010,
>> 1011]
>>> then My 2nd view
>>> http://easycaptures.com/fs/uploaded/641/2476449270.pngnamed
>>> journal_acc_date which is
>>> having accountNumber-date key arrangement. [1000, 1010, 1011,
>> "2013/05/14"]
>>> 
>>> And this is my document structure http://pastebin.com/RUrBYMWR .
>>> 
>>> I've test my views, and i doing test bellow:
>>> this is for my 1st view
>> http://host:5984/myfinance/_design/journal/_view/journal_date_acc?group=true&startkey=[
>>> "2013/05/14"]&endkey=["2013/05/16"]
>>> {"rows":[
>> {"key":["2013/05/14",1000,1010,1011],"value":{"debit":0,"credit":60000000,"totalItem":2,"accLevel1Desc":"Aset","accLevel2Desc":"Kas","accLevel3Desc":"Kas
>>> Kantor Pusat"}},
>> {"key":["2013/05/14",1000,1100,1101],"value":{"debit":50000000,"credit":0,"totalItem":1,"accLevel1Desc":"Aset","accLevel2Desc":"Kendaraan","accLevel3Desc":"Mobil
>>> Dinas"}},
>> {"key":["2013/05/14",5000,5100,5101],"value":{"debit":10000000,"credit":0,"totalItem":1,"accLevel1Desc":"Biaya_dan_Beban","accLevel2Desc":"Gaji","accLevel3Desc":"Gaji
>>> Karyawan Bagian Penjualan"}}
>>> ]}
>>> 
>>> 
>>> this is test for my 2nd view
>> http://host:5984/myfinance/_design/journal/_view/journal_acc_date?group=true&startkey=[1000,1010,1011
>>> ,
>>> "2013/05/14"]&endkey=[1000,1100,1101,"2013/05/16"]
>>> {"rows":[
>> {"key":[1000,1010,1011,"2013/05/14"],"value":{"debit":0,"credit":60000000,"totalItem":2,"accLevel1Desc":"Aset","accLevel2Desc":"Kas","accLevel3Desc":"Kas
>>> Kantor Pusat"}},
>> {"key":[1000,1100,1101,"2013/05/14"],"value":{"debit":50000000,"credit":0,"totalItem":1,"accLevel1Desc":"Aset","accLevel2Desc":"Kendaraan","accLevel3Desc":"Mobil
>>> Dinas"}}
>>> ]}
>>> 
>>> Ok, once again, how to passing 1st view data to 2nd view? I want to
>> filter
>>> data by date range in 1st view,,  then i want to filter it again
>>> by account number range in 2nd view. How to?
>>> 
>>> Thank You :)
>> 

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message