I'm trying to determine how I can replace the hard-coded dates in a query with variables that I supply at run-time. Essentially, I have this:
Code: Select all
where order_date between '2015-12-13' and '2015-12-19'
How can I do that in Base?
Code: Select all
where order_date between '2015-12-13' and '2015-12-19'
Code: Select all
where order_date between :Enter_From_Date and :Enter_To_Date
Code: Select all
where "order_date" between :From_Date and :Until_Date
Code: Select all
WHERE "Order_Date" BETWEEN :Week_Begin_Date AND '2015-12-19'
After you start your database file ( *.odb ) . . . the 'connection' to the database back-end is displayed on the status bar at the bottom. Since OpenOffice / LibreOffice Base is only a database front-end ( what the user sees ) the 'work', that is, the database work, can be connected to a number of different databases. For example, not listed in any order, HSQL, H2, MySQL, Microsoft Access, PostgreSQL, IBM DB2, Firebird, etc.RhinoCan wrote:I truly don't know which database back-end I am using or how to determine that. Can you fill me in on that, just in case I have to ask another question and that information is pivotal to the answer?
As I explained in my post above . . . when you run a Query, you have the option to run the Query exactly as YOU wrote it, and, pass the Select statement directly to the database back-end. BUT, if you use ( allow ) the OpenOffice / LibreOffice Parser to first read and modify the Query, it will do it. Modification might include 'formatting' of dates, for example, if it 'assumes' you are entering a date, in, DD/MM/YY format, or, MM/DD/YY, or, DD.MM.YY, or, DD-MM-YY, etc . . . the Parser will 'convert' that to YYYY-MM-DD format. The Parser is used within the GUI ( Create Query in Design View... or Use Wizard to Create Query ) to create a Query. Also, the Parser, does NOT support some operations that the database back-end might. For example, a UNION, or, UNION ALL statement. BUT, you can use the GUI to 'start' a Query, edit it with the UNION ( etc ) and run it in "direct mode" . . . and . . . it will work.RhinoCan wrote:Also, I'm not sure what "Direct Mode" is and what the alternative to "Direct Mode" is: "Indirect Mode"? What are the purpose of each of the modes, just so that I know how to use each appropriately?
That might be done using a Form . . . perhaps other will help you here with that, or, search in the Form section, or, post that question to the Form section.RhinoCan wrote:One other followup question. In an ideal world, it would be great if I could choose the week_start_date from a date chooser instead of typing it in. Is that possible?
Code: Select all
WHERE "Order_Date" BETWEEN :Week_Begin_Date AND DATEADD('day', 6, :Week_Begin_Date)