Hi Alberto, Juraj shows how you could update existing records with a new value.
I suppose though you may be asking if you can create a default value statement for the table definition, which performs a transformation to the data supplied by the user when new records are inserted. The short answer is yes, but not using any Base tools, nor using a create table statement in the SQL window. You can create a default value statement using a create table or alter table SQL command that can call a function, but there is no way to pass in a value to the function. That doesn't mean it can't be done. HSQLdb supports triggers and yes you can do this with a trigger. An HSQLdb trigger must be a static method in a java library. There are special considerations if you want to alter the data entered and write it to the field within this trigger. Specifics of the interface for these java triggers is covered in the HSQLdb documentation available at http://hsqldb.org or as part of the distro. Another option is to use a basic macro attached to a form to perform the calculation before the inserted record is written to the table. For something like the example, that would be a three line macro maybe. The down side to is that the value only gets changed if the form is used to enter the values. The other thing is that very often it is not necessary to actually store the altered value. Instead it is common to store the base value and use calculated fields in queries to alter the data when it is read. Of course if you are wanting to do this in order to form a natural key of some sort, that doesn't help in the least. Drew On 9/10/07, Juraj Trenkler <[EMAIL PROTECTED]> wrote: > > Dňa Po 10. September 2007 18:16 A.Muller napísal: > > Hi all !! > > > > Can anyone help, please. I'm trying to build a simple base with names, > > addresses and so on. One field, however, should be calculated > > automatically from the field "year" + 3. As simple as that, but I cannot > > input the right formula. Has anybody got an idea how to do it ? Thanks > > in advance. Alberto Muller > > > Try to import the database and then "update table set field=field+3" > > Maybe this could help. > > juraj > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
