Oct 26, 2023 01:53 PM
Im using Retool with Sequin to link my airtable database to Retool and im trying to insert into a link field some data but i cant do it like how i would normally insert a field with a sql query
Solved! Go to Solution.
Oct 27, 2023 10:27 PM - edited Oct 31, 2023 11:56 PM
You can't just put some random text to link field.
Usual value of link field is array of objects:
When you work with usual Airtable in browser or app, you can paste value or values, separated by comma.
each value is a Name of record to link.
These values should exist in the primary field of a linked table, otherwise it creates a new record with such name (name is a value of a primary field) and empty other fields. If record can't be created, it does nothing.
In script, you usually need to put array of IDs, not a list of strings. Like this.
[ {'id':'rec123Abc456dEF'} , {'id':'rec890qwerTYUI'} ]
to clean cell, you need to pass empty array []
Oct 27, 2023 10:27 PM - edited Oct 31, 2023 11:56 PM
You can't just put some random text to link field.
Usual value of link field is array of objects:
When you work with usual Airtable in browser or app, you can paste value or values, separated by comma.
each value is a Name of record to link.
These values should exist in the primary field of a linked table, otherwise it creates a new record with such name (name is a value of a primary field) and empty other fields. If record can't be created, it does nothing.
In script, you usually need to put array of IDs, not a list of strings. Like this.
[ {'id':'rec123Abc456dEF'} , {'id':'rec890qwerTYUI'} ]
to clean cell, you need to pass empty array []
Oct 30, 2023 09:28 AM
i ended up with the next insert query:
INSERT INTO table (linkfield) VALUES ('recipxpYRlJ16okEX')
and it worked, thank you very much.
Nov 01, 2023 12:20 AM
Great to know. As former MSSQL DBA, I tried to find a way to use T-SQL in Airtable, didn't find an easy way to do it. Then I learned JS basics and found it more convenient for my purposes.