Sales Comment line in a report

In this report:

DataItem Name
Customer
Sales Line
Item
Sales Comment Line
Integer
Integer Integer2

How can i show once time the sales comment line.

Like this, the comment lines appears any time that sales line appaears. So if I have 3 line i will have 3 time the cooment.

I want only once. How can i do it?

You could set up your Sales Comment Lines into a temp variable rather than directly referencing them as a data item.

Change the Sales Comment Line to an Integer data item. In the OnAfterGetRecord, check the TempSalesCommentLine for matching records. If you find one, then display it and then delete it from the temp variable. Then you will only show the Sales Comment Line once.

No that’s not a good solution at all. The comment lines are in a table that has a relationship to the sales line. Figure out what that relationship is (look at the link from the sales order form), and set the link properly between the sales line and the sales comment line tables in your report.

No need to write any code or to use an integer dataitem.

I guess I need to broaden my view to the big picture.

I saw:

and imediately thought: how can I reduce the number of times the Sales Comment Line shows up? Instead I should have asked: Why is the Sales Line showing 3 times?

For that matter what is the DataItemLink between the Customer and the Sales Line?

From the sales order form (Field Comment) we have this Form Link property - Document Type=FIELD(Document Type),No.=FIELD(No.). The relation is between Sales Header and Sales comment Line.

In my report I don’t have the Sales Header Data Item, so …

So why not put in the Sales Header data item between Customer and Sales Line.

Then link the Sales Header to Customer using Sell-to Customer. Then link to the Sales Header to the Sales Line, and from there link the Sales Comment Line to the Sales Line and you should be golden.

Thanks

Problem is solved

Filtering the Sales Comment Line’s Document Type, Document number will get you all the comments related to the order, including all comment lines that are related to the order lines. If you want to see the comments that are related to the header only, you have to set a filter on line number = 0. Add to that the link to the line number and you have comments specific to the sales line.

You were really not looking for the comments related to the sales line, but the ones related to the header. Funny how two people who misunderstand the link in the same way can come up with a solution [Y]

Ben please don’t send me private messages about an issue on the forum. If you have a question, ask it in here so that everyone benefits from the information.

To elaborate a bit on the link: The primary key of the Sales Comment Line table (SCL) is “Document Type,No.,Document Line No.,Line No.”. Records in this table are identified by a combination of these four fields.

To link a SCL record to a sales header record (SH), you link the SCL.“Document Type” to SH.“Document Type”, you link SCL.“No.” to SH.“No.”, and you set a hard coded filter on SCL.“Document Line No.” = 0. Header comments get the value 0 in the Document Line No field. That’s how you can tell that it’s a header comment. The SCL form’s autosplitkey property sets the Line No in 10000 increments, just like every other form for a table that has a line number.

To link a SCL record to a Sales Line record (SL), you link the SCL.“Document Type” to SL.“Document Type”, you link SCL.“No.” to SL.“Document No.”, and you link SCL.“Document Line No.” to SL.“Line No.”. All three fields are set by the SCL form’s link to the sales line, and the form’s autosplitkey property takes care of the line number.

So let’s say you have sales order 123, with two lines 10000 and 20000, and let’s say that you have a comment for the header (identified by Document Type = Order, Document No. = 123, Document Line No = 0 and Line No = 10000), and a comment for line 10000 (identified by Document Type = Order, Document No = 123, Document Line No = 10000 and Line No = 10000). If you set a filter on Document Type and Document No only, you will get both the comment that belongs to the heasder, as well as the comment that belongs to the line. See the picture below for what I mean:

8865.SCL.jpg

Try it. Create a new sales order, add a couple of lines, add comments to the header and to the lines, and take a look at the comments by zooming in. Take a look at the table filters when you open the comment form, you will see the filters in there. Open the sales order form in design mode and take a look at the SCL form link properties. Research what the values are, take notes, figure it out. Run the form with the debuger on, step through the code, see if you can trace where stuff happens.

When you are working on a report, you need to do the research into the data structure, you need to figure out how it works, where the links are, how the data is entered in related tables, how values are set when links are defined a certain way.

What I am writing in here is the kind of stuff that a senior is supposed to do for their juniors.

Hy Den

Sorry but I don’t undestand how to do your instructions.

At this moment my report shows, not only the comments related to a sales Header specific but also all comments from all Sales header that belongs to a Customer.

If I filter by Customer the reports is OK, but if I call all Sales from all customers I have the problem.

thanks

Hy Den

What do you meen with?

“you have to set a filter on line number = 0. Add to that the link to the line number and you have comments specific to the sales line.”

I have my report DataItem like this:

DataItem Name
Customer
Sales Header
Sales Line
Item
Sales Comment Line
Integer
Integer Integer2

But i still have the problem.