Master to Detail Records - Quicker way to do this?

  • 0
  • 1
  • Question
  • Updated 8 months ago
  • Answered
Is there a quicker way to create child records than having to press the button or importing a spreadsheet? 
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,132 Points 3k badge 2x thumb

Posted 10 months ago

  • 0
  • 1
I'm not really sure how much faster you could get than pressing a single button.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,132 Points 3k badge 2x thumb
We have hundreds of projects and need some tasks created quickly than having to ask users. Hence the question. 
You might be able to do something with a new project triggers a webhook that calls the API_RunImport call to activate a table to table import, but I'd have to know a lot more about what you're trying to do to be any more specific.
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 26,332 Points 20k badge 2x thumb
I am not sure you want a "quicker:" way to add child data or a way that has fewer navigation steps. But in any case it all boils down to where the data is coming from. Consider the variety of ways data could be used create child records:

(1) perhaps the child records are created using default data. Example: create 12 child records one for each month in the next year

(2) perhaps the child records are created using an input solicited from a dialog box. Example: display a dialog asking for the number of child records to create (and perhaps other user inputs)

(3) perhaps the child records are created based on a records in a related table used as a template. Example: create child records by copying records from a related table

(4) perhaps the child records are created by parsing a selected file. Example: invite the user to select a file, parse and transform the file's contents and they add the generated records to the child table.

(5) perhaps the child records are created by scraping a web page identified by URL. Example: grabbing prices, addresses or other data from an external web site.

(6) perhaps the child records are created by accessing and parsing data currently in the clipboard. Example, a user selects a table of data for a web site and pastes the data into a QuickBase form which parses and transforms the data before slotting the data into fields.

All of these scenarios are possible with script. So I would invite you to refine the source of the data and where you want it to land in QuickBasae.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,076 Points 50k badge 2x thumb
Arshad,
If you have standard sets of tasks for projects, there are techniques to create a button to import the std Tasks. Or are you asking if the Tasks, like Tribbles, can be born pregnant? Ie born with children when the are first created.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,132 Points 3k badge 2x thumb
Thanks Dan.  It is the item 3 that describes my situation.   I have a template project and therein I have created 7 tasks in a related child table and I have established an import button.  But from reporting point of view, we would like to set up all tasks in one hit.  I hope this answers your query. 

Thanks Mark. Pregnant records would be a great idea. But in my case all parent records are already there so retrospectively working on records may be a challenge.  
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,076 Points 50k badge 2x thumb
Well it is certainly possible to create a button to click to import a set of child task records.  It is just a question of how the system will know which set of tasks to copy in, assuming that different project types or some other criteria defines which set of tasks to copy in as child record to the Project.
Photo of Dan

Dan

  • 1,176 Points 1k badge 2x thumb
It sounds like Arshad already has the button in place (or knows how that works, at least), but doesn't want to click it hundreds of times...once for each Project.

I've come across similar issues--I've successfully set up a webhook to use API_CopyMasterDetail based on a single-record operation, and you can use API_ImportFromCSV to update multiple records, but I haven't figured out a way to combine them (so, updating a batch of records and having the CopyMasterDetail run for each one).
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,076 Points 50k badge 2x thumb
I'm not a script writer, but I do have some code which will walk down a report of records and for example copy the value from one field into an other.

If that is Arshad's question, it should be theoretically possible to o have a report of Projects needing children, and run the script.  The script would just toggle a checkbox field.  My observation is that the script runs at only about 3 records per second, which is slow, but convenient in this case.

Then fire off  a webhook to import the children triggered off that toggle field changing.  The Webhooks are limited to 10 per second, but the script seems to only run at 3 per second so that should work.

.  
(Edited)
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,132 Points 3k badge 2x thumb
Thanks. This looks like a real solution if I may. 
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,132 Points 3k badge 2x thumb
Mark

Just trying to take you back on this.  In my case as soon as a project is 'activated'  I would like the master to detail  action take place.  Could you help with this as suggested?  
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,076 Points 50k badge 2x thumb
This can be done with a Webhook but due to the complexity of the syntax in a Webhook, I can’t post the answer here. I would have to get it working in a real app and work out the syntax.

But basically the first step is to build the URL formula button to do the import to create the children records, and then fire that URL with the Webhook.

The API guide has the syntax for the Copy Master Detail API.
Photo of Dan

Dan

  • 1,176 Points 1k badge 2x thumb
It would look something like this: