Forum Discussion

AshleyAsante's avatar
AshleyAsante
Qrew Cadet
7 years ago

Automation for copying records in a report to a new table

I have a table of orders. (Name, Order Number, Address, item number,etc)
I created a summary report to eliminate duplicate order numbers, and I'd like to automatically copy that to its own table. Is that possible through automation?

I know I can manually copy the records to a new table, but I am not able to think of a way to have these records copied to another table automatically. 
  • When viewing a report, under "More", there is an option to "Copy these records to another table". This then takes you to a fairly detailed window with a bunch of options for how the import should go. 
  • But is there a way to automate this process? I can manually run this report and have the records copied to a new table ----- but I'd like this to happen daily or weekly, without me having to be the trigger
    • AlexGale's avatar
      AlexGale
      Qrew Captain
      I know you can automate Table-Table imports using the Automations feature, and you can have Automations run on a schedule. 

      I would recommend going into the target table and clicking More>Import/export>From another table. From there you can create and save a table to table import. 

      Next you just have to set up an Automation. You can have those run on a schedule, and you can have them trigger Table-Table imports. 

      When setting up the Table-Table import, I know that you can use the merge feature to update already existing records and handle duplicates, but I don't know much about how that's done. 
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      This issue will be that a saved table to table import can only be at the detail record level, but Ashley wants to copy across a summary report.  I often wish I had the same feature as a Summary report can be used to create an index table of unique Key fields as a Parent to detailed methods.

      The only way I know how to do this would be to have an automation or an action to add a record to the Parent index if the detail is added and there is no parent.  But that would probably fail if a bunch of detail records were imported causing the webhook limit of 10/second to be exceeded.
    • LauraThacker's avatar
      LauraThacker
      Qrew Captain
      Another option is to utilize Google Scripts to do this; but it is non-native and has development costs.
  • My head hurts trying to understand both the question and the replies. You people are so deep into the native feature jargon and their associated limitations I have no idea what you are trying to accomplish. Just state in simple terms what you are trying to accomplish and exemplify it with field and table names and sample data if necessary.

    The following may or may not help lead to a solution:

    One thing you may not be aware of is that if you take a saved summary report URL (say qid=5) and add the parameter &opts=csv to the URL you will in fact get a CSV response of the summarized data (not the raw un-summarized fields). This makes it almost trivial to import the summarized data into a second table with script. For example code like this will copy the CSV associated with a summary report (qid=5) and import it to a second table:

    var dbid = "";
    var dbidRecords = "";
    var dbidSummaryOfRecords = "";
    var apptoken = "";
    $.ajaxSetup({data: {apptoken: apptoken}});
    $.get(dbidRecords, {
      a: "q",
      qid: "5",
      opts: "csv"
    }).then(function(csv) {
      console.log(csv)
      $.post(dbidSummaryOfRecords, {
        act: "API_ImportFromCSV",
        records_csv: csv,
        clist: "6.7",
        skipfirst: 1
      }).then(function(xml) {
        console.dirxml(xml);
      });
    });
    • _anomDiebolt_'s avatar
      _anomDiebolt_
      Qrew Elite
      That is true - you would need to including some type of external server or service to trigger complete automation. But without adding any additional costs, complexity or additional points of failure it isn't too much to just click a button within a Tasks table.

      None of the webhooks, actions or automations will allow you to run user supplied code (in any language).