Can anyone please explain why aggregate length = linecount + 1?

Hi Daniel.

If you don't explicitly specify the Max Records of an aggregate, the OutSystems platform tries to optimize it according to how you're using the aggregate.

If you bind the aggregate to a Table Records (or List Records), OutSystems understands that the number of records that are going to be displayed will be limited by the LineCount of that widget. The platform chooses to optimize the Max Records to be StartIndex + LineCount + 1, to be able to display every record in the current page, and to allow some navigation widgets to detect if there's a next page.

You can change this default optimization by explicitly setting the Max Records yourself.

This optimization should be safe - it should never produce visible differences (unless you're relying on a different behaviour of the Length property). So if you're seeing a side-effect on your application, I would be interested to know your use case.