Closed GoogleCodeExporter closed 8 years ago
I'm not able to reproduce the bug with the current version (167) of BkperApp.
Are you using the latest one? If not, could you please upgrade to see if its
already fixed?
Original comment by m...@nimbustecnologia.com.br
on 19 Mar 2015 at 7:29
Original comment by m...@nimbustecnologia.com.br
on 19 Mar 2015 at 7:39
The update seems to have fixed the original error. My current implementation
looks like so:
report = ledger.getBalanceReport("=after:$m before:$m+1");
data =
report.createDataTable().setBalanceType(BkperApp.BalanceType.TOTAL).build();
The result is an empty array (except the column names). Am I understanding this
wrong? I would of expected the result to return the balance of all accounts for
the current month.
Original comment by jmgil...@google.com
on 19 Mar 2015 at 9:26
[deleted comment]
This is the expected behaviour. I don't know if it makes sense to return
balances of all accounts.
If you get the groups balances, the accounts balances should come also.
You're trying to minimize the round trips, right? Maybe it makes more sense to
create a method that supports many queries at once and keep the queries as
simple as possible. What about that?
Original comment by kris...@nimbustecnologia.com.br
on 19 Mar 2015 at 10:16
Basically I'm just trying to reproduce what you guys have on the sidebar on the
Bkper navigation where it lists all 'real' accounts and their respective
balances.
As far as I can tell the only way to do that currently is by making multiple
queries which isn't terribly efficient.
Original comment by jmgil...@google.com
on 19 Mar 2015 at 11:54
Actually you can access all Account objects, and query its balances. Here is
the code to reproduce the sidebar:
{{{
function listAccountBalances() {
//Change your ledger id
var ledger = BkperApp.openLedgerById("agtzfmJrcGVyLWhyZHIOCxIGTGVkZ2VyGNKJAgw");
var accounts = ledger.getAccounts();
for (var i=0; i < accounts.length; i++) {
var account = accounts[i];
if (account.isPermanent() && account.isActive()) {
Logger.log(account.getName() + ": " + account.getBalance());
}
}
}
}}}
Here is the Script to play:
https://script.google.com/a/nimbustecnologia.com.br/d/1sRC0GV0AbWG_kpp1D4QOoK0qH
UMFur7sHbB7AbcTf84ge-UvEsrZF75i/edit
By the way, did you try the new Update and Auto-Update feature on Google Sheets
Add-on? Now every fetch statement keeps connected to bkper, and you can update
it anytime, or turn on auto update to keep its synchronized hourly. All data
comes in a way to easily create charts. You can create advanced dashboards, its
a way cool!
We will publish a video about it soon.
Original comment by m...@nimbustecnologia.com.br
on 20 Mar 2015 at 11:45
Thank you, I had forgotten about that function.
Original comment by jmgil...@google.com
on 24 Mar 2015 at 6:29
I just updated the documentation to include this example:
http://about.bkper.com/api_appsScript.html#listAccountsBalances
I will close this Issue now.
Original comment by m...@nimbustecnologia.com.br
on 24 Mar 2015 at 2:15
Original issue reported on code.google.com by
jmgil...@google.com
on 17 Mar 2015 at 1:28