Forum Discussion

Francesco_Achil's avatar
Francesco_Achil
Qrew Member
5 years ago

One To One Relations (i.e. Subclasses)

Hello everyone,
I'm trying to develop an app in QB and am facing a quite odd problem. I cannot find a way to create a one-to-one relationship between two tables.
I've only found this: https://community.quickbase.com/communities/community-home/digestviewer/viewthread?MessageKey=94d0a927-d358-4d8d-bb0a-ce11d273cb8c&CommunityKey=d860b0f8-6a48-487b-b346-44c47a19a804 on one-to-one, but it is not what I'm trying to accomplish unfortunately.

I'm used to develop in python and Django, so for simplicity let's say I'm trying to develop this usecase:
https://docs.djangoproject.com/en/3.0/topics/db/examples/one_to_one/

In Django I'm able to use the "admin" app and easily embed the fields from the generic table (Place) into the form for creating a specific record (Restaurant), the linked generic record is automatically created on save with the information entered in the fields in the form, so the user does not have to:
- start creating a restaurant
- switch to create a place
- link the restaurant to the newly created place
- finish creating a restaurant
Instead the user should be able to create everything in one single step.

In my app now I have the Restaurant as a child of the Place, but cannot find any way to achieve this sort of "create a record of a subclass".

What would it be the easiest way to do it in Quickbase? 

Thanks and apologies if I missed something obvious...

------------------------------
Francesco
------------------------------
  • If you truly have a one to one relationship, it begs the question as to why bother. Why not just have one table with all the fields on one table. 

    But if you like you can set up an Automation to trigger on Creating a Place, to create a child Restaurant. Linked to the Parent Place. 


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • Francesco_Achil's avatar
      Francesco_Achil
      Qrew Member
      Hi Mark,
      thank you for your answer, in the end I went with a single table like you suggested and I'm conditionally showing the fields I need, although I'm afraid this approach may not scale up very well once I get lots of different "subclasses" with associated fields.. but it seems indeed the easiest way to integrate into quickbase.

      I discarded the automation way because I found no way to create "empty fields" on a form to fill up record created by the automation.

      ------------------------------
      Francesco
      ------------------------------