Help on using superclasses in Base

Hi,
I’m learning Base and I have a situation where to reduce redundancy and avoid errors, I would like to have a “superclass" from which two subclasses depend. Let’s say a superclass “People“ to which the classes “User” and “Expert” belong because some people can be, in different situations “users” and “experts”. I have created the corresponding tables and established the relationships between them. But I cannot find any information as to how to connect the data in a form to populate the three tables.

I would very much appreciate if someone could send me a pointer to work in this kind of situation.

Cheers,

M

Seems you are looking for a n:m-relation. One Person could be sometimes User, sometimes Expert. First table “tbl_Person”, second table “tbl_Knowledge” and the table, which connect both, “tbl_Person_Knowledge”

You have to create a form (“tbl_Person”) with a subform (“tbl_Person_Knowledge”). And in the subform should be created a listbox (“tbl_Knowledge” gives primary key to the foreign key of “tbl_Person_Knowledge”).

Have a look for the start-example in the Base Guide: Introducing to Base

Thank you for your answer!

I’m afraid I was not clear. I’m thinking more about a situation where people can play one or more roles and you want to avoid re-entering their data (name, surname, birth date…) for each one of these roles. Having an intermediate table per role seems excessively complicated. Perhaps the best representation of what I want is explained in page 52 of this tutorial:
https://wiki.documentfoundation.org/images/0/02/Base_tutorial.pdf

Unfortunately, the tutorial does not explore that possibility further and hence doesn’t explain how to mark, in a “Persons form”, whether the person is (in their example) “patient”, “therapist“ or both and how, by doing that, the PersonID would be transmitted to the “Patient” and “Therapist” tables.

I hope that with that example my question is more clear.

Had a look at page 53 of the example. The mainform would be “Person”. There will be two subforms of this mainform, one for “Patient” and one for “Therapist”. Don’t know why the “Phone Number” should be a separate table.

“Medical Doctor” and “Psychatrist” will be listboxes in the subform “Patient”.

Indeed, but my question is how to build the “Patient” and “Therapist” subforms.

The relationship between “Patient” and “Person” tables, for example, implies that the primary key of an entry in the “Patient” table references its primary key in the “Person” table.

When I enter data in a “Person form” I should identify this person as “Patient”, as “Therapist” or both somehow, presumably through the “Patient” and “Therapists” subforms, so that if, for example, the person in question is “marked” as “Patient”, its PersonID appears in the “Patient” table as its PatientID. But I cannot see how to make that. I thought of using check boxes, but I can’t make them do what I expect.

Thank you for your help!

Create a form by the wizard. Set “Person” as Mainform, “Patient” as subform.

Edit this form and open the form navigator. Now add a second subform for “Therapist”. Connect to Mainform by the primary key of “Person”.

You won’t need a checkbox for input all you need. If you have added the content to Mainform and one of the subforms you have added a “Person” and, for example a “Therapist”.

There isn’t marked a row from “Person” as “Patient”. It could also be there will exist “Person”-rows without content in “Patient” and in “Therapist”.

Thank you Robert!
I agree with your second paragraph, but I’m not sure to understand what you mean in the first one. It looks to me that if a “Person” was both a “Patient” and a “Therapist” I should enter the information twice, on each of the subforms?
But I will think in the direction that you suggest.

Yes, that are different informations in the example´ for the subforms. “Patient” and “Therapist”. In the mainform will set “Person”, which contains data needed for both subforms.