API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Dedicated method for retrieving entry totals

0
For financial reporting apps, we have now exposed a dedicated method ? GetEntryTotalsByDate() ? for retrieving entry totals for a specified date interval and set of accounts. This makes it possible for financial reporting apps to run much faster since you don't need to download potentially thousands of entries for summing up manually.

Here is a small example ? retrieving all accounts? entry totals for the calendar year 2011, using only 3 round trips:

[color=#40BFFF:1xi1bsxo]IAccount[/color:1xi1bsxo][] accounts = session.Account.GetAll();
[color=#40BFFF:1xi1bsxo]DateTime[/color:1xi1bsxo] startDate = [color=#0040FF:1xi1bsxo]new[/color:1xi1bsxo] [color=#40BFFF:1xi1bsxo]DateTime[/color:1xi1bsxo](2011, 1, 1);
[color=#40BFFF:1xi1bsxo]DateTime[/color:1xi1bsxo] endDate = [color=#0040FF:1xi1bsxo]new[/color:1xi1bsxo] [color=#40BFFF:1xi1bsxo]DateTime[/color:1xi1bsxo](2011, 12, 31);

[color=#0040FF:1xi1bsxo]decimal[/color:1xi1bsxo][] entryTotals = session.Account.GetEntryTotalsByDate(accounts, startDate, endDate);

[color=#00BF80:1xi1bsxo]// Let's save ourselves a few hundred round trips...[/color:1xi1bsxo]
[color=#40BFFF:1xi1bsxo]IAccountData[/color:1xi1bsxo][] accountDatas = session.AccountData.GetDataArray(accounts);

[color=#0040FF:1xi1bsxo]for[/color:1xi1bsxo] ([color=#0040FF:1xi1bsxo]int[/color:1xi1bsxo] i = 0; i  accounts.Length; i++)
{
             [color=#40BFFF:1xi1bsxo]Console[/color:1xi1bsxo].WriteLine(accountDatas[i].Number.ToString() + [color=#BF4040:1xi1bsxo] - [/color:1xi1bsxo] + accountDatas[i].Name + [color=#BF4040:1xi1bsxo]: [/color:1xi1bsxo] + entryTotals[i]);
}
created Feb 24, 2012 by Michael Hammer
0% Accept Rate
Q 6 A 2 C 0

2 Answers

0
Hi Michael,

Where can I find this method?

I have already downloaded the latest version of your API, e-conomic-api-1-4-5-2.zip where file version of Economic.Api.dll is 1.4.5.43906, and cannot find any method called GetEntryTotalsByDate in this library.

Regards,
Filip
answered Feb 28, 2012 by Filip
0
Hi Filip,

It's available on IAccountUtil - which you can find via session.Account; as per Michael's example.


Best regards,
answered Mar 1, 2012 by Christian Estrup
Visma e-conomic A/S
...