Discussions

Expand all | Collapse all

Automation - Add dynamic amount of records to a table

  • 1.  Automation - Add dynamic amount of records to a table

    Posted 12-05-2018 13:52
    I'm looking to add records to a table via an automation based on a variable numeric field in the trigger table. So if the field is 1 I add one record to a table, if 2 then 2 and so on...


  • 2.  RE: Automation - Add dynamic amount of records to a table

    Posted 12-05-2018 14:43
    Low tech solution if you have a limited number of choices for the # of records to be added, say between 1 and 10 is to have 10 Automations and fire them based on checking that number.

    It is also possible to write a looping Automation which will increment a counter and then trigger itself to run again as long as the counter is still less that the number to be added.

    You can do up to 100 loops before Quick base will assume that you may have created and endless loop and stop the process.


  • 3.  RE: Automation - Add dynamic amount of records to a table

    Posted 12-05-2018 19:59
    I think the looping is more applicable to my desired function. Let's say I initially fire the automation to be looped based on marking a checkbox; Can I then keep firing the automation based on the incremented field changing as a result of the automation? So the trigger is any of the following fields change: checkbox & counter.

    If so, mine does not appear to increment correctly. I modify the loop numeric field in my automation. I have source set to both type and copy values. Then I grabbed the loop field and said + 1. What do I need to change to get my automation to increment a loop that continually triggers itself.


  • 4.  RE: Automation - Add dynamic amount of records to a table

    Posted 12-05-2018 20:03
    You can�t do calculations in the automation set up.

    Make a feld on your trigger record which calculates a counter plus 1 and then have the Automation map that field into the counter.


  • 5.  RE: Automation - Add dynamic amount of records to a table

    Posted 12-11-2018 14:25
    I have implemented this solution and it is working to my satisfaction. Thanks for the input.


  • 6.  RE: Automation - Add dynamic amount of records to a table

    Top
    Contributor
    Posted 12-05-2018 21:04
    Don't use Automations - just use a simple native formula (with some embedded JavaScirpt)! If you use 100 looping Automations QuickBase will run low on inventory and everyone will be effected.

    Without loss of generality, I am going to assume you want to create N child records associated with a parent record you are viewing.


    Here is the demo:



    Create N Child Records ~ View Parent Record 
    https://haversineconsulting.quickbase.com/db/bn8aam6y8?a=dr&rid=1

    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=td&rid=698

    Notes:

    (1) Feel free to create your own parent record and add your child records to it by viewing the parent record and clicking the button.

    (2) You can customize the formula further by editing some of the hardcoded ids and apptoken

    (3) No code pages was used in the creation of this demo.

    (4) This is a great way to initialize child records representing a number of fixed assets such as seats in a class,


  • 7.  RE: Automation - Add dynamic amount of records to a table

    Posted 12-11-2018 14:26
    I will look into this as an alternative to the loop. I'm not concerned about having a single looping automation in my app.