SQL javascript API How to quickly delete all rows in a list and/or create temporary tables/lists to do SQL Operations

LabKey Support Forum (Inactive)
SQL javascript API How to quickly delete all rows in a list and/or create temporary tables/lists to do SQL Operations dabaker3  2018-10-24 11:04
Status: Closed
 
I did get this following code to work for delete all rows in a table, but it does use EXT4.
I am not sure if there is any negative impacts, but the keys and list does look like they remained intact.
It may be that the deleteRows() is not doing a batch delete, where as the truncateTable will do batch(s) delete which is at least 30x faster.

 I scrubbed it from code in a truncate list post from a few years back and combined it with what a delete all button javascript code in the that the console reported:
       
        var waitMask = Ext4.Msg.wait('Deleting All Rows from List...', 'Deleting Rows');
    Ext4.Ajax.request({
        url : LABKEY.ActionURL.buildURL('query', 'truncateTable'), // or 'query/[containerPath]/truncateTable.view' if it is in another container,
        method : 'POST',
        success: function(response) {
                waitMask.close();
                next_function_to_do();
            },
        failure : function(response, opts) {
            waitMask.close();
            Ext4.getBody().unmask();
            LABKEY.Utils.displayAjaxErrorResponse(response, opts);
        },
        jsonData : {
            schemaName : 'lists',
            queryName : '[queryName]'
        },
        scope : this
    });