According to documentation, one can set a Default value for any field type in a table, but I cannot set it!
I thought the problem was only on MySQL databases, (see previous post), but in an attempt to get round problem, I created a new database in OOBase natural format. When I tried to create a table, and set a default for a 'Decimal' field, the Table would not save.
Is there a limit to 'Type' of field this works for?
[Solved] Setting Default value for a Field
[Solved] Setting Default value for a Field
Last edited by GowerMick on Thu May 03, 2012 12:48 pm, edited 2 times in total.
Mick
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
Re: Setting Default value for a Field
Works for me.
I get default 9.87 when inserting into the table and 3.14 when inserting into the form.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Setting Default value for a Field
But your table does not have a default set (according to Table View)!!
The post specifically referred to setting a Default in a Table View, as per documentation, i.e. in the field property box (not via SQL).
In your example, (which does seem to work by the way) how can one tell what the default value is?
Once table is created, and SQL is deleted, one could never find out!
Mike
The post specifically referred to setting a Default in a Table View, as per documentation, i.e. in the field property box (not via SQL).
In your example, (which does seem to work by the way) how can one tell what the default value is?
Once table is created, and SQL is deleted, one could never find out!
Mike
Mick
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
Re: Setting Default value for a Field
Again: All the graphical Base tools are rubbish. You must not use them or at least you must not rely on them.
Sometimes they fail, more often they do not offer all options that could be done, they suppose things that are not always the right things to do while hiding away the other things that need to be done.
Simply ignore most of that shit and work with a mature database program of your choice. Then connect a Base document to that database, add useful queries, design some usable input forms and reports. Since the overall quality of reporting tools is not so much higher than the other shit, I use to drag queries into office templates.
Sometimes they fail, more often they do not offer all options that could be done, they suppose things that are not always the right things to do while hiding away the other things that need to be done.
Simply ignore most of that shit and work with a mature database program of your choice. Then connect a Base document to that database, add useful queries, design some usable input forms and reports. Since the overall quality of reporting tools is not so much higher than the other shit, I use to drag queries into office templates.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Setting Default value for a Field
I agree! Even your Forms don't pick up defaults correctly if DEC field is left Blank. I'll stick to setting Default values Explicitly in the form.Villeroy wrote:Again: All the graphical Base tools are rubbish. You must not use them or at least you must not rely on them.
Mick
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
Re: Setting Default value for a Field
Everything works properly since I added another default value of 3.14 in the form control properties.GowerMick wrote:I agree! Even your Forms don't pick up defaults correctly if DEC field is left Blank. I'll stick to setting Default values Explicitly in the form.Villeroy wrote:Again: All the graphical Base tools are rubbish. You must not use them or at least you must not rely on them.
Of course the front end value overrides the backend value. If you don't enter a form value 3.14 will be used for each new record. If you don't use the form and enter directly into the table, the database puts 9.87 for a missing new decimal. Since the column is nullable you can clear existing values.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Setting Default value for a Field
When I enter a row into my table, and leave field blank, IT DOES NOT pick up default from backend database. What are you doing diferent to me? (Is it because I have a MySQL backend?)Villeroy wrote:If you don't use the form and enter directly into the table, the database puts 9.87 for a missing new decimal.GowerMick wrote:I agree! Even your Forms don't pick up defaults correctly if DEC field is left Blank. I'll stick to setting Default values Explicitly in the form.Villeroy wrote:Again: All the graphical Base tools are rubbish. You must not use them or at least you must not rely on them.
Mick
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
Re: [Solved] Setting Default value for a Field
That would be a MySQL bug which I don't believe.
I'm not sure about the correct MySQL syntax but something like this might work:
ALTER TABLE `TBL` ALTER COLUMN `COL` SET DEFAULT 13.98;
You can run it from Base (Tools>SQL...) or any other command line tool connected to your database.
P.S. Are aware of the decimal char you've got to use?
I'm not sure about the correct MySQL syntax but something like this might work:
ALTER TABLE `TBL` ALTER COLUMN `COL` SET DEFAULT 13.98;
You can run it from Base (Tools>SQL...) or any other command line tool connected to your database.
P.S. Are aware of the decimal char you've got to use?
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved] Setting Default value for a Field
No, definitely not a MySQL bug. I can set the default from Base via SQL, and the Table in MySQL is altered correctly (default set to 20.00 as I wanted, as confirmed via MySQL Workbench)
Howver, the default value in the backend (MySQL) is not getting back to the frontend (Base), even after refreshing tables.
Howver, the default value in the backend (MySQL) is not getting back to the frontend (Base), even after refreshing tables.
Mick
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home
LibreOffice 7.2.6.2 (x64)
Oracle Report Builder
Windows 10 Home