I eventually got the report working, with a little help. Here’s the run-down:
The query editor GUI
was originally meant to work with HSQLDB, which does not implement some of the functions you would be accustomed to in SQL Server and others. As of LibreOffice 7 (which is what I’m using at the time of writing), even if you enable the Firebird embedded database feature instead of using the old HSQLDB back-end, it still expects HSQL syntax. Some complicated queries can’t be created graphically but work when you write it in the SQL view and click run. And then there are yet some that require you to make use of SQL commands native to Firebird or whatever database you’re using. In those cases you need to select Run SQL Directly
. The same applies to reports, so you need to go to the properties in the right hand pane. First click somewhere in the blank gray area at the bottom to make to pane show the “report properties” and then in the Data
tab, look for Analyze SQL Command
. Set that to NO
, so that it lets Firebird process the query instead.
Date And Time Examples
HSQLDB and Firebird have different functions for date and time here’s some of what I used. Try not to get them mixed up.
– WITH FIREBIRD Embedded–
For getting the current date, use this sub-query: SELECT CAST('Today' AS DATE) FROM rdb$database
For getting the current week number: EXTRACT(WEEK FROM (SELECT CAST('Today' AS DATE) FROM rdb$database))
To check if some date in a table is in the current week something like this should do: EXTRACT(WEEK FROM "dateSched") = EXTRACT(WEEK FROM (SELECT CAST('Today' AS DATE) from rdb$database))
– WITH HSQLDB Embeded–
DATEDIFF() and NOW() work, so you can check for an interval between dates like this
WHERE DATEDIFF('DAY',NOW(), "dateSched" )<7 AND DATEDIFF('DAY',NOW(), "dateSched" )>=0
SEE HERE FOR MORE DIFFERENCES
HOW TO MIGRATE FROM HSQLDB