Report sales invoice lines

Hi all,

I am new here.

This is my first question.[:)]

I am making a report where I show sales invoice lines.

I need to show all lines from sales invoce except lines that have “Internal Correction” equal 1.This value is in Sales Invoce Header.

I don’t know how to filter this. This is easy in SQL where I can use INNER JOIN.

Can someone help me with this.

Hi, try something like this and put it in the OnAfterGetRecord trigger:

IF SIH.GET(“Sales Invoice Line”.“Document No.”) THEN

IF SIH.“Internal Connection” = 1 THEN

CurrReport.SKIP;

Enter SIH record Sales Invoice Header into your global variables

Run the report through your debugger and see if this gets the results you are looking for. Good luck with it!

What are the dataitems you have in report?

If you have Sales Invoice Header also then directly pUt the filter in DataItemTableView

I have only one dataitem(Sales Invoice Line).
DataItemNav.png

I tried to like you told me but I got this error “You have specified an unknown variable Internal Correction”.

I entered SIH record into global variables.

Can you give me more advice.

Thank you.
dataItemError.png

Where is the field ‘Internal Connection’ available in Table?

Sales Invoice Header or Sales Invoice Line ?

The name of field is “Internal Correction” and it is present in table Sales Invoice Header.

Where did you write code to get the Sales Invoice Header?

Can you show us the code?

Hi, did you try to use the code I mentioned above? Use the C/AL Symbol Menu (F5) to find the field you need. Make sure you use the field name and not the caption. Note, in my code above, I mistyped ‘correction’ with ‘connection’. I hope this helps!

That helped me. At the first time i just copied your code.

Thank you very much.[:)]

Nice! thanks for letting us know