Imported data into linked tables

OK, @ahaller07 from AirDev helped me figure this one out.

The main issue was that I did not create a field of Type “Attorney” in the Case Object. Even though I am very familiar with one to many, many to one, peer to peer, etc… relationships in SQL database, I just didn’t think I had to do that in Bubble. I thought that was only necessary for the one to many! Should figure out that is why there is a selection box for that! Duh.

Anyway, in order to hopefully show others, I am going to lay out the steps of what to do in order to bring your databases into Bubble and link them properly. Just replace my Attorney and Case reference to whatever you are using.

Again, thanks Andrew!

For reference: I have two csv files to upload: Attorneys.csv and Cases.csv. Both have a field called AttorneyID which linked them in previous database. I have also created both objects Attorney and Case in Bubble database with all the necessary fields.

  1. Create the field relationships like mentioned above. In my example:

    Attorney object
    “Cases” field of Type “Case” (points to Case object). Click on “This type is a
    list of elements” checkbox. In other words, One Attorney can have many cases.

    Case Object
    “Attorney” field of Type “Attorney” (points to Attorney object).

  2. In the “App Data” tab in the “Data” section, click on “upload csv”

Upload the Attorney.csv first (my external Attorney.csv file that contains all attorney information) into the Attorney object in Bubble.

Repeat step for cases.csv (my external cases.csv file that contains all or the attorney cases) BUT DO THIS:

  Map the AttorneyID in the cases.csv to the Attorney reference in the Bubble Case 
  object. That will bring another field "Field to Match". Choose the AttorneyID in 
  the Attorney Bubble object.

NOTE: That will cause the Case bubble object to not have an AttorneyID! (You will only be able to map it to the reference field and not to the AttorneyID field in the Case Object). Either add another AttorneyID field in your csv or create a workflow to do that later.

You need the AttorneyID in the case object in order to complete the following step…

  1. So now, the cases know about their attorneys, but we still need to have the attorneys know about their cases!

        Create a new page with a button: "Populate List of Cases for all Attorneys"
        Create a new Workflow
        Add an action - Data - Make changes to a list of things
        Type: Attorney
        List to Change: Search for Attorneys  (Go through all attorneys in database)
        Click on "Add another value" button and add...
        Cases "add list" - search for cases where Case.AttorneyID = This AttorneyID.
        (basically: for each attorney found, add all cases to his list of cases if 
        the AttorneyID in the case object matches this AttorneyID.)
9 Likes