You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, I'm trying to implement my own tools to interact with the Actual, but I didn't find any API calls that could simply give me the total balance of an account. Although I probably could just get all transactions with a super early starting date and sum them up, it's a little bit more tedious than getting the value in one go.
Just curious, is this intentional by design? Why the Account object can't simply include a "balance" field? Or am I missing anything?
Thanks.
Describe your ideal solution to this problem
Add balance field to Account, which has the current balance value of that account.
Teaching and learning
No response
The text was updated successfully, but these errors were encountered:
In the meantime, developers can use the ActualQL feature:
// Get balances for all accounts as of a certain dateconstbalancesAllAccounts=(awaitrunQuery(q('transactions').filter({date: {$lte: '2024-03-31'}}).groupBy('account.id').select(['account.id','account.name',{balance: {$sum: "$amount"}}]))).data;// Get balance for a single account as of a certain dateconstbalanceMyAccount=(awaitrunQuery(q('transactions').filter({date: {$lte: '2024-03-31'},'account.id': 'YOUR-ACCOUNT-UUID-HERE',}).select(['account.id','account.name',{balance: {$sum: "$amount"}}]))).data;
If you need the current balance as of 'today', either put that date into the filter or remove that condition entirely.
Verified feature request does not already exist?
💻
Pitch: what problem are you trying to solve?
Hi there, I'm trying to implement my own tools to interact with the Actual, but I didn't find any API calls that could simply give me the total balance of an account. Although I probably could just get all transactions with a super early starting date and sum them up, it's a little bit more tedious than getting the value in one go.
Just curious, is this intentional by design? Why the
Account
object can't simply include a "balance" field? Or am I missing anything?Thanks.
Describe your ideal solution to this problem
Add
balance
field toAccount
, which has the current balance value of that account.Teaching and learning
No response
The text was updated successfully, but these errors were encountered: