Inheritance in bubble

Hi everyone. I searched in the forum something similar but didn’t find.

I’m learning how bubble works and was thinking if it is possible to make inheritance.
I know I can create a field in a table that access the unique id(or reference?) of other object.

My test was:
I created a table Person which has the fields name and age,
then I created the Professor which has the fields salary and person (the reference, right?)

After that, I tested Creating new things.
Step 1: create new thing of type Person with name and age from input.
Step 2: create new thing of type Professor with salary from input and person from result of step 1, only when step 1 is not empty

Ok, this works and I can access the Professor name and age, but my question is when I access this field person from the table Professor, bubble walks through all the table Person trying to find this reference or he knows exactly where it is like it was an index of an array?
And is there a way to Do a search for, set the type Professor, and in the constraint I access the person’s age for example?

Thanks for any response.

Believe me, there is TONS of content regarding this topic, maybe try some other keywords :stuck_out_tongue:

You can do the following:

Set type to Person, then do a Search for Professor’s Person. Then in the constraints you can access the Person’s fields.

1 Like

I surely used the wrong keywords then :sweat:

I’ll try workaround with what you said.

Thanks man :slight_smile: :slight_smile:

So, I’m trying to do that:
Create a new Person only when the input name is not in the table Professor…
in the constraint I would like to access the Person reference name

I also tried that, but I think contains in this case can genarate many bugs:

Sorry if this is a stupid question, but I’m struggling to understand
Thanks again, vincent.

Make sure that if a database field is an Object, make sure that your Input field also outputs the same Object. That is what is going wrong in your top screenshot.

I don’t know what the Input Name’s value is but if it is an Object, then it won’t work. But if it’s an Object’s Reference, then you can use it in the constraint.

For searching for things as the condition, make sure to select ‘first item’ to referece the first item in the list that matches the constraints.

However, I think you are overcomplicating things here. If this needs to go in one workflow you could do soemthing like this:

Step 1: create new person > Step 2 > Create new Professor where ‘Person is result of step 1’, only when step one is not empty.

The point is, there are 100 ways to get to your end result and the example you give now will probably not be the correct approach for what you need. But the only way to find out is to just continue down this path. You will eventually think: ‘Oh wait, this actually needs to be like this!’ Boom, level up :smiley:

1 Like