Discussions

 View Only
  • 1.  Creating multiple child records based on the quantity of a field in the parent table

    Posted 03-17-2020 10:22
    Hi,

    Is it possible to create multiple child records automatically based off of a quantity field in the parent table?

    For example - A new parent record is created and the Order quantity field in the parent record is 25. I would need 25 new child records created.

    Second nice to have feature would be that each new record has a component number assigned from 1-25.

    ------------------------------
    Allison Corriveau
    ------------------------------


  • 2.  RE: Creating multiple child records based on the quantity of a field in the parent table

    Posted 03-17-2020 13:00
    There are many ways to do this and its not clear from your post if you want the user to click a button to make this happen or if the children should be created when the Parent is first saved.

    One no code solution is to use an Automation to run a save table to table import.

    The setup will be to create a table called Focus Parent with a single record in it.  It will be Record ID# = 1.  There needs to be one numeric field called [Record ID# of Focus Parent] and also a numeric field for the [# of Children needed].

    Then make a table of records called Future Children numbered from 1 to say 1,000 - whatever the highest number of children you would ever need created.  Import a set of records from Excel, and include a field for [Child Number]. 

    Then make a relationship between Focus Parent and  Future Children based on a formula numeric field called [Link to Focus Parent (=1)].  Make that be a formula field equal to 1.  Look up the ​value for the [Record ID# of Focus Parent] and [# of Children needed].

    Next make a save table to table copy from Future children to the Parent's child table.  Set the field mapping to assign the field for Related Parent to the [Record ID# of Focus Parent] and and include the  [Child Number] so the children will come in numbered.  Limit the filer on the records to where the [Child Number] is less than or equal to the  [# of Children].

    Lastly, decide what will trigger the Automation. For example you might want them created when the Parent is created or edited, and the [# of children needed] is >0​ but the Parent has no children yet (base that off a summary field).

    The Automation steps would be to 
    1. Edit the Focus Parent record to set the  [Record ID# of Focus Parent] and [# of Children needed].
    2. Run the saved table to table import.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Creating multiple child records based on the quantity of a field in the parent table

    Posted 05-21-2021 16:49
    Just wanted to thank you for this Mark - it works perfectly! I was having a difficult time figuring out the best way to create month records for a lease term and this solved the problem. You rock!

    ------------------------------
    Albert Campani
    ------------------------------



  • 4.  RE: Creating multiple child records based on the quantity of a field in the parent table

    Posted 09-02-2022 12:29
    Is there a way to now do this via a pipeline?

    I am looking to have records created in a separate table based on a QTY entered in the original table.  

    So if a part is ordered and we ordered a QTY of 15.  Create 15 new records in the separate table to then track each part's unique serial, MAC, etc..

    ------------------------------
    Joshua Case
    ------------------------------



  • 5.  RE: Creating multiple child records based on the quantity of a field in the parent table

    Posted 09-02-2022 14:46
    I will offer up my no code solution. No doubt there is a more elegant solution available using more advanced Jinja,  but this will work on a no code basis.

    Make a helper table and upload from Excel the numbers from 1 to 1000. 

    Trigger the pipeline and do a search against that table where the Order Qty is less than or equal to the number in the helper table. 

    The use a For Each loop to create your children.

    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------



  • 6.  RE: Creating multiple child records based on the quantity of a field in the parent table

    Posted 03-17-2020 15:03
    Allison,

    Do you have Pipelines?   

    There is supposed to be a For Next loop in that.   It would solve your issue if you can put a loop around your quantity field.

    Quick Base is rolling out now but I have only seen the webinar.    As soon as I get a hold of it, this is the first feature I am going to test.


    ------------------------------
    Don Larson
    Paasporter
    Westlake OH
    ------------------------------