CURRENT_DATE or TODAY default date in Base

Hi Guys,

I'm trying to set a default date ( CURRENT_DATE or TODAY ) ie, Todays date
into a date field in a Base Form with no luck.

Also tried to enter it into the table as a default date - no luck.

Please advise if this is a known bug and if there is a workaround.

Best regards

John

The Base GUI is too stupid to do that trick. It all depends on the database
you are actually using.
For the embedded HSQLDB type of database that is:

menu:Tools>SQL...
ALTER TABLE "My Table" ALTER COLUMN "My Date" DATE DEFAULT CURRENT_DATE NOT
NULL

You may leave out NOT NULL or you may unckeck Edit>Database>Advanced: "Form
checks for required fields". Otherwise you get a form errors about missing
data.

Hi Andreas,

have tried this but although the Status window in the Execute SQL Statement
Dialog Box reports "1: Command successfully executed." there has been no
change to the table.

BTW I am using latest version of LO with Ubuntu 11.04

LibreOffice 3.3.3
OOO330m19 (Build:301)
tag libreoffice-3.3.3.1, Ubuntu package 1:3.3.3-1ubuntu2

Is there an error log that I can check out to see why the SQL request
failed?

Best regards

John

Hi John,

have tried this but although the Status window in the Execute SQL Statement
Dialog Box reports "1: Command successfully executed." there has been no
change to the table.

The command Andreas gave you updates the table definition so that the
next time you enter a set of data into the table, whether by editing the
table view directly or via a form, it should input the current date
automatically.

If this is what you have already tried, and it is not working, then I
would surmise that it may possibly be linked to this bug :

https://bugs.freedesktop.org/show_bug.cgi?id=38337

for which there is currently no remedy...

Alex

Thanks Alex,

at least the dropdown in the form Date field has a "TODAY" option saving the
user a little time

Regards

John

I use the database software (command line Tools>SQL...) to set DEFAULT
CURRENT_DATE.
In the Base forms I use to not include the date field when I want the
nothing but the current date/time. When I want a user editable date/time, I
use to add a label like: "Date (default: today)" as a reminder that the form
field is optional with the current date as default value.

Hi,

When I created my forms about 8 years ago, the OpenOffice Base tutorial then recommended the use of the drop down date field. It isn't as nice as having a date automatically entered, but it is relatively convenient.

Tractor wrote:

Hi,

When I created my forms about 8 years ago, the OpenOffice Base tutorial
then recommended the use of the drop down date field. It isn't as nice
as having a date automatically entered, but it is relatively convenient.

Others learn a dead horse of a programming language in order to avoid the
one click too many.

http://user.services.openoffice.org/en/forum/download/file.php?id=5762
Example DB with 2 forms for user-defined default values (organically grown,
no trace of Basic or other script pollutant)

Alexander Thurgood wrote:

The command Andreas gave you updates the table definition so that the
next time you enter a set of data into the table, whether by editing the
table view directly or via a form, it should input the current date
automatically.

If this is what you have already tried, and it is not working, then I
would surmise that it may possibly be linked to this bug :

https://bugs.freedesktop.org/show_bug.cgi?id=38337

for which there is currently no remedy...

Alex

All those bugs and incomplete implementations relate to Base. I was using a
completely different software which is very mature and really free of
obvious bugs.
When we call Tools>SQL... in a native database, we leave this office suite
and send a command to the underlying database software. This will allways
work correctly as far as we use correct SQL syntax.

What I forgot to mention:
menu:View>Refresh Tables lets Base re-read all table definitions so the
relations and table designs "take notice" of the changes we applied to the
underlying database software.
Nevertheless, the Base GUI will not show any dynamic default values
CURRENT_DATE, CURRENT_TIME, nor CURRENT_TIMESTAMP simply because these
expressions are no valid dates, times, time stamps.

Default CURRENT_USER, set in the stupid Base GUI for a VARCHAR field, will
put the literal word 'CURRENT_USER'.
All works well when you leave behind that broken GUI sometimes and default
CURRENT_USER will put the name of the logged-in database user which is the
system administrator 'SA' in all embedded HSQLDB.

Thanks Andreas,

I had not realised that the Base GUI would not show the changes applied to
the underlying database.

Your solution works fine. How do I mark the Topic as SOLVED?

Best regards

John

DiscoverHow.Co.Uk wrote:

Your solution works fine. How do I mark the Topic as SOLVED?

Since this is a mailing list, there are hundreds mail copies distributed
already. There is no way to add/update/delete anything that has been posted
already. This is a huge advantage for collaborating groups, but it is a
nightmare for online help desks.

Hi :slight_smile:
+1

It's all good now that you have said it is solved.

The best we can do is put "[Solved]" in the Subject-line as i have done or/and
just to say that the problem is solved, as you have done. Then people who view
the threads thro Nabble or something can see the problem is solved.

http://nabble.documentfoundation.org/CURRENT-DATE-or-TODAY-default-date-in-Base-td3292686.html#a3306544

Regards from
Tom :slight_smile: