Forum Discussion

JustinPauga's avatar
JustinPauga
Qrew Cadet
8 years ago

Line items from an estimate to a project

I have a table called estimates that has a one to many relationship with a table called items. This allows our project managers to add line items when they are quoting an estimate. I want to have a table called Projects that takes the information from an estimate and turns it into essentially a work order. I have been able to populate the Projects with all the information that I need from an estimate, however, I cannot get the items from the estimate to the related projects. Any help is greatly appreciated.
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    If you wanted to go with a 100% native option, you could use a combination of API edit buttons, and quick base 'actions' to edit the existing line items, and connect them to the newly 'won' project.
  • You want to use the method API_CopyMasterDetials which is documented here.

    https://help.quickbase.com/api-guide/index.html#api_copymasterdetail.html

    API_CopyMasterDeails copies related records in the identified tables in one fell swoop. Other than assigning appropriate values to the foreign key fields (eg [Related Parent]) it does not modify any other field values during the process. The method API_CopyMasterDeails  is probably underutilized as it takes a little more planning to map out what tables are participating and how to set the parameters.

    Another approach which is even more versatile is to use script with multiple API methods such as API_DoQuery, API_AddRecord, API_ImportFromCSV and additional logic in the script to initialize, increment or otherwise calculate values for some of the fields being created. If you want counters, periodic dates, "one of each item in a list"  or other calculated fields this is the method to use.