i want to add purchase comment line in purchase header (Purchase Order Report)
I want to add code like VbCrLf (In visual basic or Visual basic .NET)
PurchaseCommentLine.SETRANGE(“Document Type”,PurchaseCommentLine.“Document Type”::Order);
PurchaseCommentLine.SETRANGE(“No.”,“No.”);
IF PurchaseCommentLine.FINDSET THEN
REPEAT
IF PurchaseCommentLine.Comment <> ‘’ THEN
CommentText := CommentText + ’ ’ + PurchaseCommentLine.Comment;
UNTIL PurchaseCommentLine.NEXT = 0;
I put the following code into the OnAfterGetRecord of the “Purchase Header” data item of report 405:
CommentText := ‘’; PurchaseCommentLine.SETRANGE(“Document Type”,PurchaseCommentLine.“Document Type”::Order); PurchaseCommentLine.SETRANGE(“No.”,“No.”); IF PurchaseCommentLine.FINDSET THEN REPEAT IF CommentText <> ‘’ THEN CommentText := CommentText + ‘’; // backslash this is the NewLine Character for TextBoxes CommentText := CommentText + PurchaseCommentLine.Comment; UNTIL PurchaseCommentLine.NEXT = 0;
Then I put a textbox into the PageLoop Header section with the following properties:
Height = NoOfLines * 423
MultiLine = Yes
SourceExpression = CommentText
From this you can see a basic problem, because the height of the textbox cannot be changed dynamically. So the output is limited to some maximum NoOfLines from the “Purch. Comment Line” table. May be you can use an indented data item, if NoOfLines exceeds a certain value depending on where you put the textbox in the section, and print the remaining comment lines in a corresponding body section… - It may also be better practice to put the first comment lines, which have to be printed in the header section, into a text array with corresponding NoOfLines textboxes instead of putting them into one multiline textbox, because the code (and the section layout) would become more “readable” or “clearer”, respectively. Furthermore you would not have to take care of textoverflow, etc. if you would choose an array of Text80…