How to make a temporary table, which fetches the data from two existing tables?


I am working with two tables in NAV 2009 R2, ‘Sales Invoice Header’, and ‘Sales Invoice Line’. Now I want to make a temporary table which merges the data from both of these tables. I am doing so because I need to make a report which needs all the values from both the table under same header.

Can you please guide me, how can I make such table.

Thank You.

Elisha, you are asking the wrong question. You need to start with the business requirement, i.e. the report. What do you need and why can’t you do it the way every other Navision developer would do it? Why do you need to do it this way?

Well David, I was not in this project while developing these forms. Now I have been hired to make the reports… and I didn’t find the better solution.

I am new in NAV.

While making reports I am able to link both the tables, but while generating the reports, I had to fetch the data in different section (like sales line in sales line portion and vice versa).

If possible I would like to know if I can generate a report in which i can fetch all the data from two or more tables under same Header.

Hi Elisha, you don’t need to create a temp table to create the report you need. Take a look at existing reports like Sales Invoice, etc and see how Sales Invoice Header and Sales Invoice Line are linked up in DataItem by checking out the properties. You may be able to save a lot of time by modifying an existing report as opposed to creating one by scratch. You’ll also notice when researching existing reports, that very few (if any?) of them use temp tables to combine multiple tables. Good luck!

Hi Elisha,

The RTC version of NAV is still new enough that most of us old-timers automatically presume that you’re working in the Classic version of the client. But, it’s now very much worth asking. Which version of the client are you developing this report for - RTC or Classic?

Hello Gerorge,

I am working in classic version of NAV 2009 R2, not in RTC.

If that’s the case, then I’d have to agree with David. There’s a better way to get this done. Take a look at the Sales Invoice report to see how to define and access Parent/Child datasets. If you need to add a control in the SalesInvLine.Body section that refers to a field in the header, then create the textbox control in the body section using the Toolbox, and set the source expression to SalesInvoiceHeader.“field name”. Obviously, you’ll replace “SalesInvoiceHeader” with the actual name of your parent record as defined in the DataItem list, and you’ll replace “field name” with the name of the field from the parent record that you want to display on the child body section.

That should get you there,

First of All why you required Temporary table ?

In Report you can direclty link both the tables and put fields of tables in any section of Report

Amol Sir,

I have made the link between two tables with “No,”, and “Document No.”

My problem is, when I put a textbox that contain an expression of Sales Header in the body section of Sales line (while generating the report) I usually get the first line blank, and only in the second line i get the data.

What else properties do i need to set?

Is it possible for you to showcase the screenshot of the reports?


I want the Outlet in the header (Which is possible as it is just a labe), and the textbox of “SalesInvoiceHeader.sell-to customer name” in the sales Invoice line, body… When i just drag the textbox in the body(7), I get the first line as blank as shown below


The Outlet for SNo. 2 should go to SNo. 1

Outlet field is in which table ???/

outlet field is in Sales Invoice Header, which is “Sell-to Customer Name”.

Filter Sales Invoice Line with type as ‘Item’

I didnt get you… please explain.

you told me i can put any data in any section, so how can I put them?

Did you set proper DataItemLink between sales invoice line and Sales Invoice Header?

you told me i can put any data in any section, so how can I put them?

Yes, you can put them after reading the basec technical documents…ask for the proper training in your office…

Yes Mohana,

I have set the proper dataItem link between the two tables as “No.” and “Document No.”

Can you tell me more which i can follow.