Help

Scripting block: delete empty records

7473 6
cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting empty records

Sometimes a base ends up with empty records - records with no values in any fields. Here is a utility to delete them from a table.

A table with several empty records

deleteBlankRecords1

Using the script

deleteBlankRecords2

The script asks for confirmation before deleting. Because there is no data in any of the fields, the record ids are shown.

deleteBlankRecords3

The table with no empty records:

deleteBlankRecords4

Here is the code:

https://gist.github.com/kuovonne/8837d4c153ee1d1e4214412763b5c58e

deleteBlankRecords.js
/*******************************************************************************
Title: Delete Blank Records for Airtable scripting block
Author: Kuovonne Vorderbruggen
Website: kuovonne.com
Date Created: March 4, 2020
Version: 1.0
Copyright (c) 2020 by Kuovonne Vorderbruggen
Usage License: MIT License

## Description
This file has been truncated. show original

6 Replies 6

I updated the gist with some enhancements:

  • Sort records by the primary field. Empty records should be at the top of the sort.

  • Retrieve and check only non-computed fields. Should improve performance for tables with lots of computed fields.

  • Stop looking for empty records after reaching batch limit of 50.

  • Improved comments and variable names.

Hello Kuovonne,
I am trying to use your script to alter the following! I would like to combine the first two rows into one by replacing and delteing redundant values, and keeping the valid one under the valid field. How should i do that?

Screen Shot 2021-03-18 at 2.56.25 PM|700x130

@medairtable This script is not designed to combine rows. It is only meant to delete completely empty rows.

If you need to merge multiple records, I recommend looking into the Dedupe app.

I did look into it but ended up filtering and reorganzing my data based on filters and groups. It took some time but i was in control hehe.

I have another problem and looking for a solution, it would be great if you give me ideas.
I have a team generating leads. Every-time a person fills a form, an incremented leads on his row under {Lead}. It shows the total leads this person got.

Goal: I want to know how many leads are in on a week to week basis. I am not sure how should i do that?
Is it through a last modified field and a formula?

In order to calculate statistics for a week, you need a table of weeks, with a row for each week. Then you need to link data records to the proper week. Finally, use rollup (and possibly count) fields to perform the calculations.