Forum Documentation Showcase Pricing Learn more

Database question - using fields from two different databases in a repeating group


#1

Hi there,

I’m developing an app for teachers in my school, to facilitate the process of tracking students’ infractions.

I created a simple page (page1) with different input forms (search box to choose a student name a simple input box to choose a date and time and a dropdown to chose infractions). The student name is coming from a database (I’ll call it A for this purpose) and the infractions from a second one (B). All this is going to database C.

I want to create a second page with a repeating group (page2) where each teacher (current users) can see the infractions that were given only to the students they advisee (on database A - there are two fields: students names and their advisor names).

In other words, if the current user is also the advisor of one of the students that were issued an infraction by other user (database C) the current user is able to see that information in page2.

Because the information that I want to show exists in two different databases (A and C) I haven’t found a way to do it because I don’t know how to relate both in the same repeating group.

Can someone help me figure it out how to do this?

Thank you so much,

Alfredo Pereira


#2

So … (field names with field type in brackets).

Student table (A)

  • Student Name (text)
  • Advisor (User)

Infraction table (B)

  • some sort of text ?

Student Infrations ©

  • Student (Student)
  • Infraction (Infraction)

Note that I am linking the tables by having the field types as ANOTHER TABLE. This links one table to another.

Also note, am using “table” which is Bubble’s “Data Type” - I think you have used “Database” in your explanation, but they are all the same thing.

Then my repeating group is …

Search for Student Infrations © - filtered where Student Infrations’s Student’s Advisor is Current User.


#3

Student table (A)

Student Name (text)
Advisor (User) - It doesn’t let me write either text or an e-mail. How can I link this field to the different users?

Student Infractions table C

Student (Student) I assume the field type should match exactely the field name Student Name from table A, right?
Infraction (Infraction)


#4

Thank you so much. I have another problem now:

The fields Infractions and students have a long code instead of text. Is there a way to change that?


#5

That’s the unique identifier of each thing. So you can actually reference each field of the students listed, instead of just a student name.


#6

I’m confused, should I do that search in the repeating group or in the text appearence? Also when you say “Filtered” you mean “data source”? I think I’m missing something here.
34%20PM


#7

But if I import the the data on the table Am I going to see the identifier or the unique code?


#8

You would reference “Current Cell’s Student’s First Name” (or whatever the field is called), so you should be able to control it fully.


#9

Then my repeating group is …

Search for Student Infrations © - filtered where Student Infrations’s Student’s Advisor is Current User.

When I chose Table C (Student infractions) as my Type of Content on the repeating group I cannot use the students’s advisor field since that field is only on table A.


#10

That is what Bubble’s “Apostrophe Language” does for you.

It links tables together.

As Table C is linked to Table A (because it has a field that has a field of type Student) then you can jump from Table C > Table A using this field.

In fact, rather than have the Advisor’s name on Table A, which duplicates data (assuming every Advisor is a user) … you could have the Student Tables “Advisor” field as type User. And have a name on User.

So you can now go … Table C > Table A > User Table

Current Cell’s Student’s Advisor’s Firstname.

Now add in a table called “Pet” and add it to User as a field with a data type of Pet.

Current Cell’s Student’s Advisor’s Pet’s Name.

Table C > Table A > user Table > Pet Table.

etc etc

Have you done the tutorials ? This is absolutely key to how Bubble works.