When should I put things in an object vs a separate table

Options
Hi there,

First off, loving Xano. 

I was banging my head against the wall as I was unable to make a "db1 of db2" add on work and realized I hadn't created an object before adding a table reference.

Followed the instructions here https://docs.xano.com/database/database-relationships for a many to many relationship.

I had a couple questions:
1.  Why wouldn't an add on work with simply a TABLE RELATIONSHIP field in the database?
2. The last paragraph of the documentation asked the question "When should I put things in an object vs a separate table." Would someone mind explaining what that would look like in the context of the example provided (students > enrollments >classes)?

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     

    An Addon does work with a single table reference as well as lists of table reference. I'll review the documentation if it made you think otherwise.

    It's not really a black and white answer. Xano gives you the flexibility of either. Part of it for sure is preference and also how much data you are expecting. You wouldn't want to store lots of data in an object because Xano performs full object replacements when updating a record, so you'd have to update everything just to update a single item of the object. 
  • Abdullah Abdulkareem
    Options
    Hi Michael, is there a way to Add-on an Object from db1 (Object 1) to nest under another Object in db2 (Object 2), assuming both are linked to the same item?

    When I've tried to set up the add-on it only gives me the option to link the entire db2 directly to the object but no way to link object 2 directly to object 1.

    Putting it in context of students & classes & homework:
    Student has several pieces of homework that they must complete
    Classes provide several pieces of homework

    db1 = Classes
    > Object 1 = Homework provided by the Class
    db2 = Student
    > Object 2 = Homework student completed
    db3 = List of All Possible Homework Assignments(referenced in Object 1 & Object 2)

    Is there a way for me to get a list of all pieces of Homework provided by the class that the student completed?