Hi there,
I am trying to update a record in Airtable that has attachments and using the Update Record Airtable module. For the attachments, I can use “Add Item” where I can then add a filename and a URL and add items as I need them OR I could use map.
The issue with this is that sometimes I might only have two items to add, sometimes 3 or max 5. When I add five items, but only actually receive 3 from the array, then the module gives me an error :
The operation failed with an error. [422] Invalid attachment object for field Fotos: {}
For each item, I add use the following function(s):
{{if(get(map(2.array; "data"); "1.fileurl"); get(map(2.array; "data"); "1.fileurl"); )}}
{{if(get(map(2.array; "data"); "1.filename"); get(map(2.array; "data"); "1.filename"); )}}
For example :
In my example, the 5.fileurl and 5.filename are empty, so they will give an error.
What I would like to achieve is for them not to be used if they are empty, and simply use a dynamic way to add my files as attachments to update this field on the record. I could create a very “hard-coded” mapping where I count “the length of usable items” in array contains 1, 2, 3, 4, 5 and then for each create something I can use to map the array of objects.