I need help creating a database that goes like this: "topic → subtopic → data fields" where the data fields can vary in number (n) and are otherwise identical for every subtopic

Hello,

basically I have a topic which is divided into several subtopics. Each subtopic has the same data fields (e.g. link, read time, working time, task done). I would expect to have an ordinary table looking like this:

Subtopic 1:

Link Read Time (min) Working Time (min) Task Done
www.example.com 1 3 TRUE

And the same for a subtopic which has more data (n):
Subtopic 2:

Link Read Time (min) Working Time (min) Task Done
www.example.com 1 3 TRUE
ask.libreoffice.org
10 30 FALSE

Here, I would name the tables “Subtopic 1” and “Subtopic 2”. Now I need a way to group together those subtopics to their main topic. I would add e.g. “Subtopic 1” directly into the table but I don’t know how to handle a Subtopic needing two or more rows (because it has more than one link, read time…). So maybe I’ll just create a table containing all subtopics like this:

Main Topic
Subtopic 1
Subtopic 2

But if I do that I’d need a way to tell my forms which Subtopic belongs to which main topic and I also don’t know how to do that.

The aim is to have a report that groups the subtopics to their corresponding main topic. Every subtopic should show the data fields (link, task done…).
In a .odt file I had something like this:

1.1 Main Topic:

Subtopic Link Read Time (min) Working Time (min) Task Done
Subtopic 1 www.example.com 3 9 TRUE
Subtopic 2 ask.libreoffice.org 30 50 FALSE
                 help.libreoffice.org 15 44 FALSE

(Below, there’s also “1.2 Another Main Topic”…).

I’d like to have that but using base and databases because they give me more flexibility (using queries I can easily decide what I’ll see in my report).

I hope you understand what I’m trying to say and that you can direct me in the right direction.

Thank you in advance!

Can this be helpful in any way?

Database General

Unfortunately it doesn’t.

Let’s say you go to writer and add a table, e.g. two rows and two columns. Now go to the second column and split the field / row into two rows. It will look like the table I inserted in my question (see Subtopic 2):

In writer “Subtopic 2” would hold both rows: the one containing “ask.libreoffice.org” and the one containing “help.libreoffice.org”.

But how can I create a table in base that is just like that? A table where multiple rows correspond to the same subtopic? Creating an entire new table for every subtopic wouldn’t be ideal at all, since I’d have to create a few hundreds of them…

Maybe my question is more clear now?

Using a relational model you would create first a table TOPICS with id and topic as fields/columns, then another table SUBTOPICS with id and subtopic as columns.
.
Now you may need a third table TOPIC-COMBINED to have a list of allowed combinations. (For example, I’m working with art, so I may have the subtopic renaissance in the topics paintings and furniture, but this will not be allowed for photography.)
This table will only have ids: id, topic-id, subtopic-id.
.
Then at last you can create the table for the actual data, wich will reference the other tables (use their ids):
Id, TOPIC-ID, SUBTOPIC-ID, Link, ReadTime, …
.
In the Input-Form you may use listboxes to enter the Ids in their fields.
.
The format of your Writer-file is then created in a report by grouping by topic and subtopic.

1 Like

Have you downloaded or read the Guide for Base. There are differences between languages but especially read the chapter on report-builder.

https://documentation.libreoffice.org/en/english-documentation/