Ask Your Question
2

libreoffice base: dropdown list inside a table [closed]

asked 2015-01-07 11:16:38 +0200

maxbre gravatar image

Is it possible to define a dropdown list (based from another field in another table) inside a table in libreoffice base? Or is it strictly necessary to define a form for that purpose?

I'm wondering if there is the possibility to set up a data entry table with some special features like a drop down list (in the fashion like of ms access, for example): I've been looking for that feature but I could not find any viable solution other than defining a data entry form (which is something I would not now, at least)

thank you for any feedback

bye

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-08-15 15:28:48.294231

2 Answers

Sort by » oldest newest most voted
2

answered 2015-02-06 10:09:06 +0200

Wildcard gravatar image

I remember when I first looked into Base, before I had any real knowledge of the theory of databases, and I looked for the feature you're looking for. It doesn't exist, but there is a better way to accomplish the same thing. Let me explain:

First, you should understand "primary keys" and "foreign keys". If you are kind of fuzzy on understanding those, or don't instantly know exactly what they are and what is the difference between them, read this tutorial until you get enough theoretical background.

Now, I'll describe the feature the way I imagined it, before I knew anything about databases. I wanted to choose a name (first and last name) out of the "customers" table when inputting data into the "orders" table. I wanted a drop down list to show in the "customer" field of the "orders" table, which would concatenate the first and last names of each customer from the "customers" table.

If you understand primary keys, you will easily see that I didn't understand them at the time.

The actual way to solve what I was attempting is to have a primary key in the "customers" table which would be an integer, not the names. In the "orders" table I would have a foreign key linked to the primary key of the "customers" table.

Of course, this would be utterly useless for entering information directly into the "orders" table, because I would have to just type in a number for the customer, and just remember that "customer #65536" is "Bob Jimson". Not going to happen.

The rest of the answer is to make a FORM. In a form, NOT in a table, is where you can get your drop down boxes. The form can only be created after the "customers" and "orders" tables have both been created. It can be set up so when you go to enter a new order, using the form, you get a drop down list showing the first and last name of each customer. When you choose a customer from the list, that customer's ID# (primary key) is entered in the "customer" column of the "orders" table (as a foreign key) for the order record you are creating.

The "how to" on this is covered quite well in the tutorial I linked to, but this should hopefully give you some idea of how the pieces fit together.

(If this answered your question, you can mark it as answered — green checkmark.)

edit flag offensive delete link more
1

answered 2015-01-21 04:57:49 +0200

doug gravatar image

You could use the grid element in a form, which has the desired minimalist appearance. Define individual fields in grid as lists bound to other tables.

edit flag offensive delete link more

Comments

hi, thank you for your reply;

I've been trying to go in the direction you are pointing me but I'm not sure I can exactly grasp what you mean; would you mind practically showing me "how to": I would like to have a dropdown list in a field of tbl_A based on a field in tbl_B

thank you for your help

maxbre gravatar imagemaxbre ( 2015-01-22 10:19:27 +0200 )edit
1

Wildcard got it. I was suggesting you make a form, and in the form, under more controls use the table control which in some LO documentation is called a grid. The element looks exactly like a table, although it resides in a form and is part of a form. Then right mouse click on the column selector/column header and select replace with and list box. Follow wildcard's suggestion for table setup.

doug gravatar imagedoug ( 2015-02-07 04:43:16 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2015-01-07 11:16:38 +0200

Seen: 11,300 times

Last updated: Feb 06 '15