A couple of newbie questions

Creating tables and queries
Post Reply
antieuclid
Posts: 1
Joined: Fri Apr 18, 2008 9:14 pm

A couple of newbie questions

Post by antieuclid »

Hi, I'm a bit of a newbie to Base, and so I'll probably be hanging out here a lot for a while ^_^

I have two questions at the moment:
1) Is there any equivalent of the "Auto-number" field from Microsoft Access? I'm trying to build an inventory tracking system for the art center that I volunteer with, and I need it to generate a unique item ID number when a new item is added.

2) Is there any way to re-order the fields in a table? I forgot to include a "State" field in the Artist table and now it's hanging around at the end of the table and I can't seem to get it back near the other Address fields.

3) Forms seem to always open as read-only. I made sure to allow data entry and all that during the wizard process, but it still says read-only when I open it.

Thanks in advance!
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: A couple of newbie questions

Post by Villeroy »

Windows with Java 6? OOo2.4? Statusbar shows something with "HSQL"?
Tables need a primary key to be editable (right-click field). Then you can set the PK as auto-value (select PK field and set "Auto-Value":[Yes]).
The order of fields and columns in a database is not relevant. You can create views and queries with any order of columns and rows. Anyway, this is one of the many bugs in the user interface of Base.
Some SQL commands to add/remove columns through Menu:Tools>SQL...

Code: Select all

ALTER TABLE "Table1" REMOVE COLUMN "State"
ALTER TABLE "Table1" ADD COLUMN "State" INTEGER NOT NULL BEFORE "other column"
ALTER TABLE "Table1" ADD COLUMN "ID" INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL PRIMARY KEY BEFORE "other column"
Some changes require a subsequent "Menu:View>Refresh Tables".
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
haydencohen
Posts: 1
Joined: Wed May 21, 2008 8:08 am

Re: A couple of newbie questions

Post by haydencohen »

'Then you can set the PK as auto-value (select PK field and set "Auto-Value":[Yes]).'

I've tried to looking for the autovalue function but can't find it. please help
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: A couple of newbie questions

Post by Villeroy »

Right-click the table... "Edit"
Click the column, choose "Auto-Value=Yes" at the bottom of the screen.
Right-click the column... "Primary Key"

or use SQL commands as outlined above.
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
xtine_m
Posts: 11
Joined: Wed Feb 06, 2008 6:56 am

Re: A couple of newbie questions

Post by xtine_m »

Villeroy wrote:Right-click the table... "Edit"
Click the column, choose "Auto-Value=Yes" at the bottom of the screen.
Right-click the column... "Primary Key"

or use SQL commands as outlined above.
Hi! I'm kinda new at this one. But when you mean right-click the table you are referring to the one I attached? Since I couldn't see the "Auto-Value=Yes" when I click edit.

Thanks!
Attachments
main.tiff
main.tiff (55.57 KiB) Viewed 3505 times
User avatar
kabing
Volunteer
Posts: 678
Joined: Fri Nov 23, 2007 12:05 am
Location: Midwest, USA

Re: A couple of newbie questions

Post by kabing »

Only certain kinds of field types (e.g. Integer) have an autovalue option.

Forms will always say "Read only" at the top of the window unless they are in design mode. This is because the form controls are read only in those situations. As long as 1) the table(s) involved has a primary key and 2) the form is not based on queries, the data should be editable in the form.

Fields cannot be reordered in the table design view. It's annoying, but not really a big deal, as you can change the orders in forms, queries, and reports.

kabing
NeoOffice (app store version) OpenOffice.org 4.1 and LibreOffice 4.3 on Mac OS X El Capitan
OpenOffice.org 4.1.2 on Windows 10 (Previously on Vista)
Post Reply