i want to see only returned order(order that have negative value)

I make driver shipment report in dynamic nav from this fields

delivery no - date - order no - customer - area - qty - plant - pump - driver name

1 12-5-2011 15 Ahmed wall 12 6 5 adil

1 12-5-2011 15 Ahmed wall -12 6 5 adil

2 12-5-2011 17 Sharif earth 17 2 2 nizam

3 12-5-2011 18 wael wall 16 8 7 manzour

but in report i found two orders have same values one negative and one positive(example 5,-5) this orders that returned because it damage

what i need to retrieve damaged orders in separate report to be

1 12-5-2011 15 Ahmed wall 12 6 5 adil

1 12-5-2011 15 Ahmed wall -12 6 5 adil

how can i do

please help me


to achieve the result i would set a filter onInitReport() only on “damaged” orders.

Afterward you can loop among the list of damaged order, get the original deliveryno, and than print your report.


You can add a flow field to the table that sums the amount based on Order Number. That would give you a way to filter out the orders with [Sum of Orders] =0 for one report and [Sum Of Orders]<>0 on the other.

If you have partial returns so sum of 0 does not work for you, you could just do a lookup for any negative value and set a flow field of type exists with a table filter of amount <0 which will allow you to filter for no for your standard report and yes for orders with return orders.

I m don’t understand what you say can you show to me what you say by write the steps by details

please help me


on the main table that you are drawing the reports from, you can go to the table and create a new field called [Sum of Orders] make that new field a flow filed that sums all the amounts from the same table based on where the Order Number matches. This will give you one field to use as a filter for the entire report. Then at the report level, you can set a filter where [Sum Of Orders]>0

If you choose the second suggestion, you still do the same thing. Make a new field on the table and set it to a flow field. This time instead of a sum, you will you use the “exists” option and look for anything <0. Then if anything for that order is <0, that field will say yes and you can filter them out.

If this isn’t descriptive enough, let me know and I will post a blog post with an example.

please guy s i thanks you more time about help me but some guys mention thing in this article that we can loop through the report to get return order that i mention above

can any guy send to me code if possible and which event i write

this report based on two table sales shipment header and sales shipment line table


thank you teresa burger for helping me i understand what you say but if possible can you send to me blog or you can write this coding im sorry because i asked you more time but im beginner

You check all the delivery no one by one. if a delivery no has a line with negative qty then only print that line. Otherwise you put CurrReport.SHOWOUTPUT(False);

thanks sanjoy but i need delivery no that have same value but with negative and positive (ex 5,-5,2-2) because i need to display only cancelled delivey no so that to display the cancelled must be display source delivery no if you can send code to me this best


Hopefully this will help. http://geekswithblogs.net/tburger/archive/2012/03/16/flow-fields-in-dynamics-nav.aspx

If I picked the wrong tables, the same concept will work for any header/line situation. Also, if you want the total of the quantities to be 0 rather than a neg exists, you can change the filed type from bool to decimal and the calculation in the flow field to Sum Quantity

Thanks Teresa Berger more for helping me this good solution to problem and i m applied this successfully but can i write this by code and if possible how? if you have fob file to this solution by code please send to me or by email

In the classic client, you could declare a couple of variables then do something like what is shown below in the header part of your report (untested but likely close and gives you the idea). For RTC, I will have to play with it to give you a more descriptive answer. I don’t have time this weekend but if you are still curious next week, I should be able to get to it.

Sales Shipment Header, Body (1) - OnPreSection()

SalesShipmentLine.SetRange(“Document No.”,“No.”);
If SalesShipmentLine.FindFirst then
If Not ShowNeg then
If ShowNeg then

Let me ask you on thing if you want to print only the negative valued line in the report why don’t you go to the data item and take the field like qty and filter <0 then the line which are less than 0 only will be displayed.[:^)]

i dont need negative value in separate report what i need to get returned order meaning select all document number that have negative and positive

Is there something that doesn’t work with the solution I gave you?

work good thanks Teressa

Teresa Berger some point not applied please help me

i write this code

Line.SET RANGE(“Document No.”,“No.”);
Line.SET FILTER(Quantity,’<%1’,0);
IF Line.Quantity > 0 THEN
IF Line.Quantity < 0 THEN

on body pre section on sales shipment header table but no result please help me i m sorry to make and i try until now more noisy to you


on the report, view the sections. Hightlight the title bar of the Sales Shipment Header SECTION and then press F9. Put the code in the OnPreSection there. The showOutput Function works on the report not on the table.

Teresa Berger i make these steps go to section then highlight section then i write code in pre section in report then write the code that you tell me before but no result i try to write code in every part in section but no result i think your code is true but why not get result i don’t know .to remember you the first way that you tell me that related about flow field i made successfully but i want to write these by code because if any similar situation i can do.


will e-mail you a sample report.