Detect if a JavaScript record or data item record is the last record within the current filter

Sometimes it is helpful to know whether a record is the last record within a filter because it can be used to order, to add, or to remove output, such as the sections underneath.

This can be done by using the Rec.IsLastRecord() JavaScript function.

In this example, Header.IsLastRecord() and Line.IsLastRecord() are used to detect if the Header and Line record are the last records with the current filter:

On the last page of the report output, Header.IsLastRecord() returns True, and Line.IsLastRecord() returns False for the first line and True for the second (last) line: