Summarize extended text lines

In Business Central, you can add text or comment lines for a single sales or purchase document line. These comment lines are attached to the original sales line by the Attached to Line No. field.

Take for instance the following shipment lines. One of these items is shipped, the other is not. In one scenario, you might want to hide the comment lines that are attached to the line with a quantity that is zero. In another scenario, you might want to place the line information below the test lines.

The first thing you need to do is determine how you can identify these comment lines. Fortunately, Business Central has a field called Attached to Line No. (80, Integer). This specifies the parent line. This field is automatically filled when you create the comment lines from an extended text line. Unfortunately, you cannot set this field manually so this only works for text that was added automatically.

A screenshot of a computer

Description automatically generated

The first step is to add an extra dataitem for these comment lines. You set the table to the same table as the line, and set the DataItem Link to get the lines that were attached to the parent line.

A screenshot of a computer

Description automatically generated

This gives the following:

The second step is to hide the original comment lines. To do this, you specify a Where filter on the original line dataitem.

A screenshot of a computer

Description automatically generated

This gives the following:

A white background with blue text

Description automatically generated

Now you can filter out the zero lines.

A screenshot of a computer

Description automatically generated

This will give you the following:

A white rectangular object with black lines

Description automatically generated

Finally, to place the item information below the comment lines, you need to add an integer dataitem on the line dataitem. Set Max Iteration to 1 and add a body on it.

A screenshot of a computer

Description automatically generated

This results in the following:

A white rectangular object with a black border

Description automatically generated