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:
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.