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

InvoiceData + InvoiceLineData for given period

Hi, im trying to get all data for invoices and their invoicelines for a given period.
My problem is that as far as i can see, i have to get the matching IInvoice for an IInvoiceData using the property 'Number', if i want to get the InvoiceLines. This gives me at least one request per invoice found in 'session.Invoice.FindByDate'.

Is it possible to get IInvoiceLines from an IInvoiceLineData?
or Is it possible to match an IInvoiceData on an IInvoice using something other than the Number property, e.g. some sort of Id, that isnt lazyloaded?

Below is the code in question.


            // TODO Performance problem Calls economic api with one request per invoice, when getting 'Number'
            // See TODO below
            var invoices = sessionInvoiceFindByDate(@from, to)ToDictionary(x = xNumber, x = x);
            var invoiceDatasForDebtor = sessionInvoiceData
                                               Where(x = xDebtorEquals(debtor))ToList();
            var lineDatasByInvoiceNumber = new Dictionaryint, IInvoiceLineData();
            foreach (var invoiceData in invoiceDatasForDebtor)
                //TODO Is it possible to get IInvoiceLineData's from IInvoiceData instead of IInvoice?
                var invoice = invoicesinvoiceDataNumber;
                lineDatasByInvoiceNumberinvoiceDataNumber = sessionInvoiceLineDataGetDataArray(invoiceGetLines());
created Nov 1, 2012 by larsudengaard
0% Accept Rate
Q 1 A 1 C 0

2 Answers


You can match an invoice to an invoiceData without using the number.

If you make a request getting invoices and later on grab the data based on the first request, the index of the invoiceData in the array will be the same as the matching invoice array you sent.
answered Nov 5, 2012 by nkn
Arh, of course, the sequence of the data array is guaranteed. That was exactly what i needed. Thank you
answered Nov 5, 2012 by larsudengaard
Visma e-conomic A/S