incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From polutan <linspir...@gmail.com>
Subject [ASK] How to passing 1st view data to 2nd view??
Date Wed, 22 May 2013 05:52:56 GMT
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, None, 0 bytes)
View raw message