Forum Discussion

AndreonnaGarret's avatar
AndreonnaGarret
Qrew Assistant Captain
7 years ago

Javascript SDK - Copy Parent and Child records to two new tables

So I have been working on this project relentlessly for a while now, and I feel that I am so close. I am creating checklists, and am using 4 tables to do so. I have the following tables

Checklist Task Templates
Checklist Templates
Checklists
Tasks

I have this set up so that the [Checklist Task Templates] feed into the [Checklist Templates] as child records.

The idea was to then have a button that would be clicked that could copy the parent and child records from the [Checklist Templates] table and put the corresponding data into the [Checklists] and [Tasks] Table. 

I got this setup from the All-Star Project + Task Templates in the Quick Base Exchange. This app did exactly what I was looking for, so I used the same logic and setup for the app I had started. However, this app uses the Javascript SDK. I made the attempt to set this up, but honestly can't figure out if I'm supposed to install the QuickBaseClient.js file somewhere, and if so where to do it. 

So after searching the community, it appears this may be an outdated method of performing this task. So I am seeking information on how to either implement the Javascript SDK method, or a more modern solution to my problem. 

Thanks!!

11 Replies

  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    That SDK is outdates yes, but you just need to reference it in you code and it still should work just fine.
    • AndreonnaGarret's avatar
      AndreonnaGarret
      Qrew Assistant Captain
      It is referenced in the code. So I must be missing some other changes in the code to get it to work in my app. 
    • AndreonnaGarret's avatar
      AndreonnaGarret
      Qrew Assistant Captain
      I read all of those things. But I don't have any other suggestions to move forward with what I need. 

      Any ideas?
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      I am catching up with my shadow and have another busy week so my answers have to be short.

      Can you generalize your problem in terms of what parameters would define the operation you want to carry out? They might even be the same parameters as the code I am telling you not to use but I don't the the time to search that source code. What I need to know are parameters such as the source and target dbid's, the clist of fids to be copied, and the related parent fid in the child table. It is easy to write the code but some thought has to go into identifying the parameters needed to define the task to be accomplished.
    • AndreonnaGarret's avatar
      AndreonnaGarret
      Qrew Assistant Captain
      Sure!

      I have 4 tables

      PM Checklists: _DBID_PM_CHECKLISTS
      PM Tasks: _DBID_PM_TASKS
      Checklist Templates: _DBID_CHECKLIST_TEMPLATES
      Task Templates: _DBID_PM_ITEMS

      The task templates pull into the checklist templates. 

      There are 3 fields on the Task Template table. 
      Task (FID: 6)
      Section (FID: 7) 
      Frequency (FID: 9)

      The same 3 fields on the Task Template table are on the PM Tasks Table.
      Task (FID: 6)
      Section (FID: 7)
      Frequency (FID: 8) 

      The Checklist Templates Table has 2 fields that pull into the PM Checklists table.
      Template Type (FID: 20)
      Status (FID: 25)

      These feed into the PM Checklists table fields
      PM Type (FID: 139)
      Status (FID: 138)

      I believe the idea here is that on the Checklist Template table I would press a button called "Generate from this Template". This would trigger the Checklist Template to copy over into the 2 fields on the  _PM Checklists _table creating a new checklist. It would also pull the child records from the _Checklist Template_ (which are actually from the _Task Template_ table) over to the _PM Tasks _table and tie them to the _PM Checklists_ table as child records. 

      I hope I explained that well enough. 

      Thank you!
  • The QuickBaseClient.js SDK can be implemented within your .js file by using jQuery. This is of course assuming that you are referencing the script directly from your button. To do this, add your code between the following.



    $(document).ready(function(){
        $.getScript("/js/QuickBaseClient.js", function(){
        
        // your code here

        });
    });