LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-13-2019, 04:31 PM   #1
mark_alfred
Senior Member
 
Registered: Jul 2003
Location: Toronto, Ontario, Canada
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572

Rep: Reputation: 210Reputation: 210Reputation: 210
How can I get an automatic date field on my Libreoffice Base file?


Hello. I created a diary in Libreoffice Base. It has four fields, those being ID, Date, Title, Entry. The ID field is a primary key field that is automatically created, and its field type is "Integer [INTEGER]". The date field is manually entered by me (which I hope to change to being created automatically) and its field type is "Date/Time [TIMESTAMP]". The other two are text fields.

Info:
I use Debian 9 (stable), and I use Libreoffice Version: 5.2.7.2
Build ID: 1:5.2.7-1+deb9u4. I have both OpenJDK 1.7 and 1.8 installed (I needed to install and enable 1.7 to be able to update my older LineageOS phone, though I've set LO to use 1.8 --> perhaps I need to change this to 1.7).

Efforts so far:
I tried searching for an answer to this and found the following: https://ask.libreoffice.org/en/quest...ction-in-base/

The suggestion there was to "place a Text box where you want the date. Then in the fields' Data tab set as follows" ... select the option of TODAY() for it. I was unable to find that option after setting up a text box. The only options were to link to existing fields, so I linked to the date field and basically had an echo of this. Thus, not a solution.

I also tried the option of Insert/Field/Date, but that didn't work.

All ideas appreciated.

Last edited by mark_alfred; 01-13-2019 at 04:33 PM.
 
Old 01-13-2019, 05:39 PM   #2
Corvette
Member
 
Registered: Jul 2017
Location: Missouri, United States
Distribution: Debian 9
Posts: 110

Rep: Reputation: 24
Try using SQL directly (Tools -> SQL in the main window) and executing a statement like this:

PHP Code:
ALTER TABLE my_table ALTER COLUMN date SET DEFAULT CURRENT_DATE 
See the following: https://ask.libreoffice.org/en/quest...tabase-record/
 
1 members found this post helpful.
Old 01-13-2019, 11:32 PM   #3
mark_alfred
Senior Member
 
Registered: Jul 2003
Location: Toronto, Ontario, Canada
Distribution: Ubuntu Linux 16.04, Debian 10, LineageOS 14.1
Posts: 1,572

Original Poster
Rep: Reputation: 210Reputation: 210Reputation: 210
[new edit]
Okay, this works perfect! Below I had an error because the old date field was deemed mandatory, which produced the error. But, since I've now got two new automatic fields for date and time, I no longer need the old date field.

Thanks again!

[prior post]
Thanks for your response Corvette. I tried what was written, but it did not work. I created two fields for both time and date. Then, for each, I used the "Tools -> SQL" function from the main window, enter the commands (adjusted for the naming of my file/fields). The commands were accepted. However, in attempting to create a new post in the diary, in a new form that had these two fields, it gave me the following error (see picture).
Attached Thumbnails
Click image for larger version

Name:	Screenshot_2019-01-14_00-30-42.png
Views:	42
Size:	18.2 KB
ID:	29459  

Last edited by mark_alfred; 01-14-2019 at 12:57 AM.
 
  


Reply

Tags
base, date, libreoffice



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
find a field from a directory search & insert that field into second file mcbobolink Programming 1 04-26-2017 05:41 PM
Xombrero: can't see text entered in address field and search field xiongnu Linux - Software 1 01-23-2016 08:20 AM
[SOLVED] awk: how to print a field when field position is unknown? elfoozo Programming 12 08-18-2010 03:52 AM
awk printing from Nth field to last field sebelk Programming 2 01-08-2010 09:39 AM
php question, how do I get a return from a field within a field? cherrington Programming 11 04-29-2009 01:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration