Quick Base Discussions

Expand all | Collapse all

Auto add child records

  • 1.  Auto add child records

    Posted 05-02-2017 18:14
    I have 4 tables -
    -Project Templates
    -Tasks Templates

    there a 3 Parent-Child relationships
    1) Projects (P) - Tasks (C) 
    2) Project Templates (P) - Tasks Templates (C)
    3) Project Templates (P) - Projects (C)

    I would use the Template tables to create -- well -- templates -- Project Template A --- will have Template tasks associated (child details)

    My goal is to create a new Project record and while in the "add record" mode --- I will select the Related Project template (parent) ---

    At this point I would like to have a "magic formula button" -- titled "Auto Add Tasks" -- that when clicked:

    1) It saves the Project record

    2) It Imports/copies the Task Template records that are related to the Related Project Template - into the Tasks Table and relates the new tasks to the new Project record

    3) Then redirects me back to the recently created Project record n Edit Mode -

    This is a doozie -- I'm sure Mark has answered this before....Thanks for any and all help. 

  • 2.  RE: Auto add child records

    Posted 05-02-2017 18:20
    Can I ask why you are not OK with the traditional solution.  User saves the record, and sees a single button controlled by fomulas or form rules to show the correct import button for the selected Template. User pushes the button.

    Have you got that method working yet? 

  • 3.  RE: Auto add child records

    Posted 05-02-2017 18:43

    Where I get lost on using the traditional "copyMasterDetail" method -- Is the fact that I only know how to use this method when Copying details from a Master record --- within the same Master table....so if I only had 2 tables within my application Project Templates & Tasks Templates -- I know how to use the traditional methods...

    But I want to leverage the Project Templates & Tasks Templates tables to populate the other two tables...so not sure how to leverage the copyMasterDetails when copying from different tables....

    the redirects are not as important....

  • 4.  RE: Auto add child records

    Posted 05-02-2017 18:58
    OK, I now understand that your task templates is not on the same table as your tasks.  I did not read your post carefully enough.

    So my next question is are you "married" (or at least going steady - I'm sure that kids have new words for that now)  to that concept to have the task template records not be on the same table as the tasks.  Typically, you would have just 2 tables and not 4.  Is it too late to go to that concept or did you have other reason to duplicate the tables.

    If you do want to maintain that concept, then yes there is a way to make a button to do that, but it does get way more complicated and would take my as long to explain how to do it than to actually do it.  It's probably an hours work  for me to set that up for you. 

  • 5.  RE: Auto add child records

    Posted 05-02-2017 19:04
    Definitely not married not really in love just very fond of the 4 tables. Let me try going with just two tables....still pretty......If I run into any issues or questions I may seek your advice...Thanks for helping me remove the beer goggles. 

  • 6.  RE: Auto add child records

    Posted 05-02-2017 19:08
    OK great. KISS">https://en.wikipedia.org/wiki/KISS_principle">KISS is usually the best plan.  Then what you do is to make a set of import buttons using the wizard and then make a form rule to show the correct button for the correct selected template choice - that template may just be a multiple choice field.

  • 7.  RE: Auto add child records

    Posted 05-03-2017 05:18
    4 tables is the way to go.  What happens when you add a new project type, and have a new template list, another button, another form rule, another template list to hide from reports...

    If you do it they way you planned (4 tables) then you get great expansion and flexibility.

    If you go 2 tables, then you have to filter out those items from all your reports that you build in the 2 tables to avoid your data from getting jumbled.

    I do the 4 table set up about once a week in different apps.

    One Con: You have to make a .js code page.