Report sorting question

I am using Libreoffice base (x64) on Windows 10 with embedded HSQLDB database for now. I have setup a database with tables, queries and forms in order to write invoices and keep control of a stock situation.

I am writing the invoice using a form and I have setup an report with SKUs and amounts etc… in the details area. The order of the SKU or items are appearing in the exact opposed order compared to have they are ordered in the form.

I have played with grouping and sorting in the report but cannot get this to work in the same order as in my form.

Any hints or ideas would be welcome.


At times you can get some of the sorting done in Report Builder itself. Often it is better if the sequence is already correct before it gets to Report Builder. To do that, the input should be from a Query or a View (basis is a query). With that you can use an Order By statement to sequence by fields in Asc or Desc sequence (ascending or Descending).

General reference see → SQL ORDER BY Keyword

Thanks much @ratslinger! I will look into this.

in case this situation may help somebody else, the best solution for me was to add the invoiceitems table ID and set it to ascending in the invoice query, this will put the items in the same order as they appear on the form. Again, thanks @ratslinger for putting me in the right direction.