Processing Report

Hi there.

I was assigned a new task. I have to write a processing-only report. From what I could tell, a processing report is like a batch file, which runs a few tasks on the background.

It shouldn’t be too hard. Basically, I have to check values from a field of a table, and if the content of that field is 0, it should copy values from a field from another table, obviously bearing in mind that the selected item of those two tables must be the same one.

Ok, so, if you could give me some pointers about where should I start, it would be great. I wish there was a beginner’s forum for these rookie questions, but I guess this is the place where the experts are…

Thanks in advance!

You should start by reading the reporting documentation. If you are a customer, check CustomerSource. If you are a partner check PartnerSource.

I’m neither a partner not a customer. I’m a rookie developer recently hired by a company and terribly inexperienced in Dynamics Nav…

What does the company you were hired by do? Do they sell NAV or sell a product related to NAV? Then they are a partner. Do they use NAV to run their business? Then they are a customer.

If they are paying their enhancement fee (customer) or partner fees then they will have access to the documentation. You can also search the C/SIDE Help menu within the client and / or MSDN. Here is a file with a lot of training:

Ok, so this is what I have until now (obviously it doesn’t work…yet):


RecItem.SETRANGE(“No.”, ‘M000000’, ‘M999999’);
IF RecItem.“Tempo Fabrico Machos” > 0 THEN BEGIN
RecRoutingLine.“Run Time” := RecItem.“Tempo Fabrico Machos”;
MESSAGE(’%1’, RecRoutingLine.“Run Time”);
UNTIL RecItem.“No.” = ‘M999999’;

What I want is to filter only the items that begin with the letter ‘M’, then if those items have a certain field > 0, I want that value to be copied to another table, but on the same item…

I tried doing it alone, with what I know until now, but I was hoping you could point me in the right direction…


I’ll point out some of the obvious ones. Firstly, have you abandoned the processing only report idea? This looks like code from a Codeunit or something based on the REPEAT…UNTIL loop. That type of loop would be automatically handled in a processing only report.

In the C/SIDE Help from the NAV Client Help Menu, search for SETFILTER. It’s like SETRANGE, but gives you more control.

Not a big deal, but when you will be looping through multiple records, do a FINDSET instead of FINDFIRST. It’s better for execution time. You can also search for the optional parameters in the same place as above.

When you are setting the value for the RecRoutingLine variable you have not retrieved a record from the database. You’ll need to do filters / ranges along with a FIND, or look into the GET function.

REPEAT…UNTIL loops are usually done as REPEAT…UNTIL myRecordVar.NEXT = 0. The NEXT will move to the next record in the filtered set.

Lookup all of these keywords in the NAV help and on the forums to find examples.

Hi Luis Correia,

I think u should use SETFILTER in the following manner instead of the SETRANGE when u are filtering the items:

SETRANGE Used by you:

RecItem.SETRANGE(“No.”, ‘M000000’, ‘M999999’);

Suggested SETFILTER as per your need:

RecItem.SETFILTER(“No.”, ‘M*’ );

Its showing an error that says something like this (I’m translating from the portuguese, so it might not say the same in English): “It’s not possible to make any changes in the database until a transaction is initiated”…

I’m not a programmer…yet, so I don’t really know what I’m doing of if what I’m doing is a Processing Report or a Codeunit. I was given a task, and that task was to create a processing report. And that’s what I’m trying to do. I appreciate you pointing me all the mistakes I make, I hope it will make me a better programmer…

Read replies carefully and implement them.

I was pointed to the right direction: they told me to eliminate the repeat…until and to write the code in the OnAfterGetRecord trigger(I’m using the Item Data Item, but I’m not sure if I should be using the Routing Line Data Item).

I’m sure I’m almost there. Here’s what I’ve got:


RecItem.SETFILTER(“No.”, ‘M*’ );
RecRoutingLine.SETFILTER(“Routing No.”, ‘M*’);

IF RecItem.FIND AND RecRoutingLine.FIND THEN
IF RecItem.“Tempo Fabrico Machos” > 0 THEN BEGIN
RecRoutingLine.“Run Time” := RecItem.“Tempo Fabrico Machos”;

If you are using Item Dataitem then no need to take recItem variable…

Set M* in DataItemTableView-Talbe Filter

In Onaftergetrecord trigger write this

Not working…

Check why it is not working?

I checked. I created an item starting with M…and its ‘Tempo Fabrico Machos’

In the Routing Line Table, after running the report, the Run Time is still 0.

It Worked for me without any problem…

BTW, do you have any Routing Lines with Newly created item in Routing No. ?

Yes, the newly created item exists in the Routing Line table…

Then it should work…

Did you search for “Processing Only” in the NAV Client C/SIDE Help Menu? The same place I mentioned you could find information about SETFILTER and other development topics? There is a step by step guide for how to create a processing only report here.

You can also search for “Classic Report Walkthroughs”. It’ll be in the middle of the results, but have that exact name (in the US version anyway).

To me it seems like you need more understanding of the basic concepts. Go through the Help Menu. There are literally hundreds of pages of documentation there. It’s what used to be known as the Application Developer’s Guide, but not it is located there instead of a monster PDF on the product CD.