Page 1 of 1

[Solved] Cannot understand the Base Guide (Chapter 8)

PostPosted: Fri Apr 13, 2012 9:43 am
by T-buch
I am new to Base
Trying to understand the official Libre Office Guide, The Base part (Chapter 8)
There is somthing on page 13 and 14 - I cannot grasp

Base Guide part (page 13 - 14).jpg.0x675.2px6wi7df6dh1tt9lnuya3rxcac3di.jpg

1.
Actually - I do not know how many tables I should made.
But I made one - called Payment Type as described in the Guide

2.
Even though I had followed the Guide slavish, the autoFiled feature does not work.
When creating the table - I can choose "set AutoValue" but when I set the PaymentID field to the primary key, the ""set AutoValue" feature is gone

Re: Cannot understand the Base Guide (Chapter 8)

PostPosted: Fri Apr 13, 2012 3:18 pm
by Villeroy
I'm sorry to say this. But the small screenshot snippet alone demonstrates the bad quality of LibreOffice documentation. That project has consumers and fans but the knowledgable community is very thin.
To answer your question for the built-in HSQLDB (you may use other types of databases as well):
menu:Tools>SQL:
Code: Select all   Expand viewCollapse view
DROP TABLE "PaymentTypes" IF EXISTS;
CREATE CACHED TABLE "PaymentTypes"(
"ID" INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,
"Name" VARCHAR_IGNORECASE(50) NOT NULL)
CREATE UNIQUE INDEX "uniqName" ON "PaymentTypes"("Name");

hit [Excecute...]
Then menu:View>RefreshTables.
I added an additional index on the names so you can not enter 2 equal names.
The field type is VARCHAR_IGNORECASE so "bank" and "Bank" are considered as equal values.

According to the warning in your LibreOffice documentation, the columns are in wrong order. In fact the order of columns and rows does not mean anything since you can easily retrieve any rows and any column in any order.
For your list box you need:
SELECT "Name","ID" FROM "PaymentTypes" ORDER BY "Name"
which picks the second column before the first and orders the rows by name.

Auto-fields should be created manually for new, empty tables. This is a tiny little bit of work and saves you a lot of trouble.

Re: Cannot understand the Base Guide (Chapter 8)

PostPosted: Fri Apr 13, 2012 6:02 pm
by T-buch
Villeroy wrote: (you may use other types of databases as well)


No the base is my first experience - But I manage to succeed your guide and your SQL commands

But should I only made one table - I think the guide is talking about many tables ("design a table for each type of information. Each table will contain.....") (For the whole text see my #1 post)

Villeroy wrote: For your list box you need:
SELECT "Name","ID" FROM "PaymentTypes" ORDER BY "Name"
which picks the second column before the first and orders the rows by name.


I am not sure what you are talking about here??
Thanks a lot for your reply

Re: Cannot understand the Base Guide (Chapter 8)

PostPosted: Fri Apr 13, 2012 6:46 pm
by Villeroy
Base is not a database. Base is a set of tools to use databases in the context of this office suite. If you create a new database in Base, then you are working with a http://hsqldb.org -database which is wrapped into the .odb file, extracted ("installed") when you open the file and repackaged when you close the file. This is not the best type of database but for the first learning steps it is OK.
If you have one table only, list boxes make not much sense. A list box lets you pick a reference to some other table's item.

Re: Cannot understand the Base Guide (Chapter 8)

PostPosted: Sat Apr 14, 2012 10:10 am
by T-buch
Villeroy wrote:If you have one table only, list boxes make not much sense. A list box lets you pick a reference to some other table's item.


I have made the tables that the guide told I should made from the previous sections of the Guide
What I mean was if this paragraph called "Creating tables for the list box" instructs me to do more than the one table called "Payment Type" - That is where I am not sure

Re: Cannot understand the Base Guide (Chapter 8)

PostPosted: Sat Apr 14, 2012 10:51 am
by Villeroy
[Example] Relations reflected by list boxes in forms demonstrates how to set up database relations by means of integer row numbers connected through the relations designer, so
-- each person has one animal and each animal belongs to many persons (one-to-many relation)
-- each person has many items and vice versa (many-to-many relation)
The forms with subforms and list boxes reflect these relations so the user can assign one animal to a person, many persons to one animal, items to persons and persons to items without even seeing the underlying row numbers.

In your database you have a list of payments (analog to my persons) and now you have a list of payment types (analog to my animals). Each payment is of one particular type of payment type.

List of Base tutorials. The first link is written by a true expert.
A copy I uploaded to this forum when the link was broken

Re: Cannot understand the Base Guide (Chapter 8)

PostPosted: Sun Apr 15, 2012 1:03 am
by DACM
As far as the 'Getting Started Guides' are concerned, I'm not sure which camp's personnel (TDF or AOO) originally developed the content but it looks like both camps have simply adopted these same guides as evident here 'Getting Started with LibreOffice' and here OpenOffice.org 3.3: Getting Started Guide.

As Villeroy eluded, the topic on page 14 'Creating tables for the list box' is rather poorly written, inaccurate in spots, out-of-place in the guide's content structure, and fails to properly present (compare and contrast) the options available for List Box content. Specifically, dedicated, rigidly-constructed, List Box table(s) are inflexible and somewhat impractical in light of SQL-based options.