{{ transformations:AirtableCommandAction.png}} ====== UPDATE/DELETE ROWS IN AIRTABLE ====== Category: Workflow / App/Cloud\\ \\ =====Description===== This action connects to an Airtable database ("base") to delete or update rows in a specified table via API Key and Base ID.\\ \\ =====Action settings===== ^ Setting ^ Description ^ |Connector*|Select the pre-configured connection to your Airtable base, or, build one by selecting //Add connector//.\\ See [[connectors:airtable|Airtable connector]] for details.| |Command|Select whether table rows will be deleted or updated. Options: //Delete// or //Update//.| * Setting can be specified using a [[:parameters|parameter]].\\ \\ ====Delete settings==== **Description:** Rows in the Airtable table with Row IDs matching those in the EasyMorph table are deleted. ^ Setting ^ Description ^ |Table name*|Enter the name of the table within the connected Airtable base to delete rows from.| |Row IDs|Select the EasyMorph table column containing the Airtable row identifier values. See "Airtable Row IDs" in the\\ Remarks section, below.| * Setting can be specified using a [[:parameters|parameter]].\\ \\ ====Update settings==== **Description:** Updates values in selected columns in the Airtable table where the Row IDs match those in the EasyMorph table. ^ Setting ^ Description ^ |Table name*|Enter the name of the table within the connected Airtable base to delete rows from.| |Row IDs|Select the EasyMorph table column containing the Airtable row identifier values. See "Airtable Row IDs"\\ in the Remarks section, below.| |When a row is updated|Select what happens to row values that are not updated. Options: //Keep the row values that are not updated.// or\\ //Remove the row values that are not updated.// See "Keep/Remove row value" in the Remarks section for more details.| |Disable automatic typecast|Prevent Airtable from automatically converting text values within certain columns (data types).\\ See the "Remarks" below for more details. | |Column names in Airtable|Select whether the column names in the Airtable table match those used in the EasyMoprh table, or if they differ.\\ Options: //Same as in EasyMorph// or //Other//. See "Column mapping", next.| |Column mapping|Select the columns in the EasyMorph table with values to be updated and select the corresponding Airtable column names.| * Setting can be specified using a [[:parameters|parameter]].\\ \\ =====Remarks===== **Airtable Row IDs:** These are unique row IDs generated by Airtable to identify individual rows. The Row IDs are retrieved from an Airtable table by using the [[transformations:importairtable|Import from Airtable]] action and selecting the //Import System ID// option. This creates a field named "_id" in the imported dataset. Alternately, Row IDs can be made part of the table by creating a //formula// field in the Airtable table and using the "RECORD_ID()" function. This column can then be imported and used as the "Row ID" column without using the //Import System ID// option. **Keep/Remove row values:** When "Remove the row values that are not updated" is selected, any values in the row that are not updated with a value from the EasyMorph table are blanked out. Use this setting when repopulating the entire record and columns without new values should be cleared. When updating single or select columns while keeping the rest of the record intact, choose "Keep the row values that are not updated" to retain the values in columns that are not being affected. **Automatic typecasting:** Automatic typecasting is a process within Airtable for converting passed-in text values to "specialized" data/field types. For example, when passing a text value into a linked table field, Airtable will attempt to resolve the table link, or create a new one if the linked table doesn't already exist. Similarly, passing a text value into a single- or multi-select field will attempt to resolve the value in the current selection list, or create a new value if it does not exist. Refer to [[https://community.airtable.com/t/how-import-via-api-a-text-string-into-a-linked-field/39125|this article]] for more details. \\ =====Examples===== **EXAMPLE 1:** Update the mountains' rounded heights in the source table with the actual height values from the EasyMoprh table. **Source table (Airtable): Five Tallest Mountains** ^_id ^Mountain Peak ^Range ^Location ^Height(m) ^ |recjrsJenaJOB2xRW |Everest |Himalayas |Nepal, Asia | 8,900| |recDzkYWPUWryep6u |K2 (Godwin Austen) |Karakoram |Pakistan, Asia | 8,600| |recDzkYXPM2Wryep6u |Kanchenjunga |Himalayas |Nepal, Asia | 8,600| |rezDmkYW23Wryep7t |Lhotse I |Himalayas |Nepal, Asia | 8,500| |recEzkmnPUWsyrp6a |Makalu I |Himalayas |Nepal, Asia | 8,500| **Update table (EasyMorph):** ^_id ^Height(m)_New ^ |recjrsJenaJOB2xRW| 8,850| |recDzkYWPUWryep6u| 8,612| |recDzkYXPM2Wryep6u| 8,586| |rezDmkYW23Wryep7t| 8,501| |recEzkmnPUWsyrp6a| 8,462| \\ **Action parameters:** > Connector is the connector to the Airtable base the table resides in. > Command is "Update" > Table name is "Five Tallest Mountains" > Row IDs is "_id" > When a row is updated "Keep the row values that are not updated" > Column names in Airtable are "Other" > Columns: Check "Height(m)_New" and select the "Height(m)" Airtable field. \\ **Result table (Airtable):** ^_id ^Mountain Peak ^Range ^Location ^Height(m) ^ |recjrsJenaJOB2xRW |Everest |Himalayas |Nepal, Asia | 8,850| |recDzkYWPUWryep6u |K2 (Godwin Austen) |Karakoram |Pakistan, Asia | 8,612| |recDzkYXPM2Wryep6u |Kanchenjunga |Himalayas |Nepal, Asia | 8,586| |rezDmkYW23Wryep7t |Lhotse I |Himalayas |Nepal, Asia | 8,501| |recEzkmnPUWsyrp6a |Makalu I |Himalayas |Nepal, Asia | 8,462| \\ \\ **EXAMPLE 2:** From the "Five Tallest Mountains" source table, remove the shortest 2 mountain peaks using the Row IDs. **Source table (Airtable): Five Tallest Mountains** ^_id ^Mountain Peak ^Range ^Location ^Height(m) ^ |recjrsJenaJOB2xRW |Everest |Himalayas |Nepal, Asia | 8,850| |recDzkYWPUWryep6u |K2 (Godwin Austen) |Karakoram |Pakistan, Asia | 8,612| |recDzkYXPM2Wryep6u |Kanchenjunga |Himalayas |Nepal, Asia | 8,586| |rezDmkYW23Wryep7t |Lhotse I |Himalayas |Nepal, Asia | 8,501| |recEzkmnPUWsyrp6a |Makalu I |Himalayas |Nepal, Asia | 8,462| **Delete rows table (EasyMorph):** ^_id ^ |rezDmkYW23Wryep7t| |recEzkmnPUWsyrp6a| \\ **Action parameters:** > Connector is the connector to the Airtable base the table resides in. > Command is "Delete" > Table name is "Five Tallest Mountains" > Row IDs is "_id" \\ **Result table (Airtable):** ^_id ^Mountain Peak ^Range ^Location ^Height(m) ^ |recjrsJenaJOB2xRW |Everest |Himalayas |Nepal, Asia | 8,850| |recDzkYWPUWryep6u |K2 (Godwin Austen) |Karakoram |Pakistan, Asia | 8,612| |recDzkYXPM2Wryep6u |Kanchenjunga |Himalayas |Nepal, Asia | 8,586| \\ =====See also===== * [[transformations:importairtable|Import from Airtable]] * [[transformations:exportairtable|Export to Airtable]]