Ask Your Question
1

TIMESTAMP data type auto-fill problem what am I missing? [closed]

asked 2017-02-27 07:13:49 +0200

kmartin gravatar image

updated 2017-02-27 09:23:44 +0200

This seams like a very useful tool. Have a table with a column of the data type TIMESTAMP, and auto fill that field in a form with the unique timestamp of date+time. I'm having a bad time with this little gremlin. Much is due to my newness to LibreOffice. I have searched the web: found https://www.youtube.com/watch?v=OBtxu...
and this forums: https://ask.libreoffice.org/en/questi... .

The tools > SQL > command to execute >

//fill in transaction timestamp field

ALTER TABLE "DailySales" ALTER COLUMN "transaction" SET DEFAULT CURRENT_TIMESTAMP

executes but I get no auto fill in the form. In fact I can not save the form until I enter something in the field and then the data in the table is bad, e.g. 1800-01-01 01:03:00 .

I am using Version: 5.2.5.1

So here I am... and thanks in advance

martin

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by kmartin
close date 2017-02-28 04:45:08.070648

Comments

re: "get no auto fill in the form", Yes, this is kind of klunky. Worse is that if you move to a new record (save the record ), and then go back to it it shows "01/01/1800" which is wrong (both wrong data and the extra 00 at the end). Only when I close the database and re-open does it appear correctly as "02/28/17". First idea is to mark these in a special color like purple to remind you that they are funky. Hope to write some Basic someday to improve user experience.

EasyTrieve gravatar imageEasyTrieve ( 2017-03-01 01:44:48 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2017-02-27 17:30:22 +0200

Ratslinger gravatar image

There are a number of issues with dates, table and View defaults. Here are a couple: Bug 102945 and Bug 104375.

This doesn't mean you cannot use a timestamp. With the set-up you stated, change the control data property on the form to Input required = No:

image description

Do this for both the Date and Time controls (or columns if using a grid). Do NOT use any defaults in the controls themselves. Now when entering a new record, you can leave the field blank for a current timestamp or enter your own information if an override is wanted. When the record is written to the table, if the field(s) are blank on input. the current timestamp will be entered by the database.

In the case of defaulting to a CURRENT_TIMESTAMP, nothing is displayed because it is not known exactly when the record will be written to the table.

If you ALWAYS want the current timestamp entered (never an override), you can even eliminate the fields (columns) from the entry form completely. The DB will then always use the current timestamp on a new record.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-27 07:13:49 +0200

Seen: 460 times

Last updated: Feb 27 '17