OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Auto Update Field for Base?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
timinak
General User
General User


Joined: 03 Mar 2011
Posts: 28
Location: Palmer Alaska

PostPosted: Fri May 04, 2012 12:10 pm    Post subject: Auto Update Field for Base? Reply with quote

In MySQL I can have a column definition like this:
Code:

modified          | timestamp        | NO   |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP

which ensures that when I change or add a record, that field will be automatically updated.
Can I have the same for Base?
URLs to other discussions or documentation is welcome.
thanks
tim
_________________
Programmer 24 years. Linux, Mac
command-line. New to OO
Back to top
View user's profile Send private message
Billyray
OOo Enthusiast
OOo Enthusiast


Joined: 06 Mar 2007
Posts: 144
Location: Lake Erie's Shore in Ohio

PostPosted: Fri May 04, 2012 12:55 pm    Post subject: Reply with quote

Base connects to MySql.
_________________
Billyray
using:
Linux distro: Ubuntu 10.04 LTS, Lucid Lynx, OOo Base 3.3, connected to MySql database using Java jdbc (note: ONLY sun-java-6-1.6.0_22 jre works right), and converted from MS Access 2003.
Back to top
View user's profile Send private message
timinak
General User
General User


Joined: 03 Mar 2011
Posts: 28
Location: Palmer Alaska

PostPosted: Fri May 04, 2012 1:16 pm    Post subject: Reply with quote

Billyray wrote:
Base connects to MySql.

I do not want to connect to MySQL. I want to define a field(column) that will automatically record when a row is changed or updated. The code was an example only.
thanks
_________________
Programmer 24 years. Linux, Mac
command-line. New to OO
Back to top
View user's profile Send private message
timinak
General User
General User


Joined: 03 Mar 2011
Posts: 28
Location: Palmer Alaska

PostPosted: Fri May 04, 2012 5:00 pm    Post subject: Reply with quote

Seemed like my post needed clarification: The example code was from
MySQL, but was there only to illustrate my need. I have to use an odb format
without an external data source, thus MySQL is out. However, I don't have
and immediate need to implement this. I would imagine that there is an event-triggered
macro that would due the trick, and if I don't figure it out, I'm sure someone at
this forum can point it out for me. So.... No worries and no MySQL
_________________
Programmer 24 years. Linux, Mac
command-line. New to OO
Back to top
View user's profile Send private message
dacm
Super User
Super User


Joined: 07 Jan 2010
Posts: 769

PostPosted: Fri May 04, 2012 7:18 pm    Post subject: Re: Auto Update Field for Base? Reply with quote

timinak wrote:
...on update CURRENT_TIMESTAMP...which ensures that when I change or add a record, that field will be automatically updated.

Can I have the same for Base?

... I have to use an odb format without an external data source

Hi Tim,

You can use a macro triggered by a Form event to update the timestamp each time the record is saved. You can optionally add the current user or initials to the macro. Otherwise, you could use a trigger in the back-end database engine to run an external Java stored procedure (ascii code file). Or upgrade to HSQLDB 2.x to use SQL procedures saved within the database. Or install and connect to MySQL on your desktop.

NOTE: Base creates an unstable all-in-one database file (.odb) as identified on the status bar by the phrase "embedded database." This configuration is not recommended for production use so at least store these crash-prone files in a Dropbox or other version-protected folder.
_________________
Soli Deo gloria
Tutorial: avoiding data loss with Base + Splitting 'Embedded databases'
Back to top
View user's profile Send private message
timinak
General User
General User


Joined: 03 Mar 2011
Posts: 28
Location: Palmer Alaska

PostPosted: Sat May 05, 2012 7:37 am    Post subject: Reply with quote

Hi dacm:
Thank you for all of the detail. That is going to be very helpful. As to your comments
about an embedded database:
I made that decision because I wanted to set up a contacts database and them
transfer it to my wife's computer without issues of not finding the external data source.
FYI: Use to work in MS-Access all the time, now work with MySQL with web apps, but
am brand new to OOBase.
But I am not seeing "Embedded Database" on the title bar.
??
But I must have more coffee.
.... more coffee....
Idea Is the absence of "Embedded Database" because I made the table from scratch
in Design View? Also, I created a form based on the table and the title bar includes
"Readonly", but I can add records. Question
cheers
tim
_________________
Programmer 24 years. Linux, Mac
command-line. New to OO
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group