I am having users attach photos and I would like a way to show the size of a file so that we can have an indication of the size of the file attached. Doesn’t anyone have a solution for this?
Thanks in advance for your help.
I am having users attach photos and I would like a way to show the size of a file so that we can have an indication of the size of the file attached. Doesn’t anyone have a solution for this?
Thanks in advance for your help.
I’m looking into this as well. You can enable “grouping” and then it’ll have an indicator for that specific group of total file size:
I’m trying to then take that total file size and roll it up into a connected table so that it shows up as just a line item. Does anyone know if this is possible? Just as you can pull in “Count”, can you pull in “Total File Size” for attached records using Rollup?
I need the “Total Attachment Size” column to just give the total attachment size for the images column.
Totally happy to calculate this in the original table for the line item if that’s what has to happen:
Can’t seem to figure it out though. Wish I could just take that “18MB” total field and have it passed through as a field in the other base.
@openside you’re a master, any ideas?
Thanks everyone!
I’m looking into this as well. You can enable “grouping” and then it’ll have an indicator for that specific group of total file size:
I’m trying to then take that total file size and roll it up into a connected table so that it shows up as just a line item. Does anyone know if this is possible? Just as you can pull in “Count”, can you pull in “Total File Size” for attached records using Rollup?
I need the “Total Attachment Size” column to just give the total attachment size for the images column.
Totally happy to calculate this in the original table for the line item if that’s what has to happen:
Can’t seem to figure it out though. Wish I could just take that “18MB” total field and have it passed through as a field in the other base.
@openside you’re a master, any ideas?
Thanks everyone!
Any luck on this? I’m trying to do the same so I can flag any images that are too large.
Any luck on this? I’m trying to do the same so I can flag any images that are too large.
@Brent_del_Rosario unfortunately not
What we ended up doing was using Integromat to shrink the sizes of the images uploaded to like 1/4th the size just in-case at the time of generating the email that we are appending the attachments in Airtable to.
Not ideal, but it has solved the issue for now. Still wish this was a data-point that we could roll-up and have triggered views and such based on it.
Any luck on this? I’m trying to do the same so I can flag any images that are too large.
Check out this extension:
This is updated version of the post (I missed some pictures in my earlier post):
Has anybody found a solution? Can’t believe there is nobody. Searched google and it doesn’t look like anybody has ever searched or asked same question. Even Integromat community doesn’t have an answer.
The Miniextenion can do that but I can’t justify spending 40 USD for 1 extension if paying 10 dollar for Airtable.
I’ll contact Integromat support, see what they say. It’s easy to get one attachment size with Integromat. You just need the Airtable Watch module and the Airtable Updater module and that will write the attachment file size into a field of your choice.
The problem is, I couldn’t find how to get total size of all attachments in the particular field. Array functions were of no help, it can get files but I wasn’t able to get the sizes to add up. Even tried adding variables etc to no avail.
I’m looking into this as well. You can enable “grouping” and then it’ll have an indicator for that specific group of total file size:
I’m trying to then take that total file size and roll it up into a connected table so that it shows up as just a line item. Does anyone know if this is possible? Just as you can pull in “Count”, can you pull in “Total File Size” for attached records using Rollup?
I need the “Total Attachment Size” column to just give the total attachment size for the images column.
Totally happy to calculate this in the original table for the line item if that’s what has to happen:
Can’t seem to figure it out though. Wish I could just take that “18MB” total field and have it passed through as a field in the other base.
@openside you’re a master, any ideas?
Thanks everyone!
Here's a related thread for a suggested feature (product idea) about attachment file sizes:
https://community.airtable.com/t5/product-ideas/attachment-file-size-type-limits/idi-p/55500
I write this script into an automation. When an attachment field is updated, it gets the sum of all the files in the attachment field and put it into a number type field.
const table = base.getTable('Your Table Name');
const fieldWithAttachments = 'Attachments Field Name';
const fieldToStoreSizes = 'Sizes Field Name';
// Retrieve the specific record based on the provided recordId
const recordId = input.config().recordId;
const record = await table.selectRecordsAsync({ recordIds: [recordId] });
const selectedRecord = record.records[0];
const attachments = selectedRecord.getCellValue(fieldWithAttachments);
if (attachments) {
// Iterate over each attachment in the field
const sizes = attachments.map((attachment) => attachment.size || 0);
const sum = sizes.reduce((acc, curr) => acc + curr, 0);
// Update the sizes field with the calculated sum
await table.updateRecordAsync(selectedRecord, {
[fieldToStoreSizes]: sum,
});
}
Remember to write your correct base name and fields in the three first lines
It works form me. Hope this solve the question.
😉
I write this script into an automation. When an attachment field is updated, it gets the sum of all the files in the attachment field and put it into a number type field.
const table = base.getTable('Your Table Name');
const fieldWithAttachments = 'Attachments Field Name';
const fieldToStoreSizes = 'Sizes Field Name';
// Retrieve the specific record based on the provided recordId
const recordId = input.config().recordId;
const record = await table.selectRecordsAsync({ recordIds: [recordId] });
const selectedRecord = record.records[0];
const attachments = selectedRecord.getCellValue(fieldWithAttachments);
if (attachments) {
// Iterate over each attachment in the field
const sizes = attachments.map((attachment) => attachment.size || 0);
const sum = sizes.reduce((acc, curr) => acc + curr, 0);
// Update the sizes field with the calculated sum
await table.updateRecordAsync(selectedRecord, {
[fieldToStoreSizes]: sum,
});
}
Remember to write your correct base name and fields in the three first lines
It works form me. Hope this solve the question.
😉
I tried this and I am getting this error? Any advice?
I tried this and I am getting this error? Any advice?
Have you define in your automation input variables??
That type of error seems to me that the script is not getting any value because input.config() not defined. But maybe if you give us more info we can understand better the issue.
😉
I write this script into an automation. When an attachment field is updated, it gets the sum of all the files in the attachment field and put it into a number type field.
const table = base.getTable('Your Table Name');
const fieldWithAttachments = 'Attachments Field Name';
const fieldToStoreSizes = 'Sizes Field Name';
// Retrieve the specific record based on the provided recordId
const recordId = input.config().recordId;
const record = await table.selectRecordsAsync({ recordIds: [recordId] });
const selectedRecord = record.records[0];
const attachments = selectedRecord.getCellValue(fieldWithAttachments);
if (attachments) {
// Iterate over each attachment in the field
const sizes = attachments.map((attachment) => attachment.size || 0);
const sum = sizes.reduce((acc, curr) => acc + curr, 0);
// Update the sizes field with the calculated sum
await table.updateRecordAsync(selectedRecord, {
[fieldToStoreSizes]: sum,
});
}
Remember to write your correct base name and fields in the three first lines
It works form me. Hope this solve the question.
😉
This worked great for me, thank you so much!
I write this script into an automation. When an attachment field is updated, it gets the sum of all the files in the attachment field and put it into a number type field.
const table = base.getTable('Your Table Name');
const fieldWithAttachments = 'Attachments Field Name';
const fieldToStoreSizes = 'Sizes Field Name';
// Retrieve the specific record based on the provided recordId
const recordId = input.config().recordId;
const record = await table.selectRecordsAsync({ recordIds: [recordId] });
const selectedRecord = record.records[0];
const attachments = selectedRecord.getCellValue(fieldWithAttachments);
if (attachments) {
// Iterate over each attachment in the field
const sizes = attachments.map((attachment) => attachment.size || 0);
const sum = sizes.reduce((acc, curr) => acc + curr, 0);
// Update the sizes field with the calculated sum
await table.updateRecordAsync(selectedRecord, {
[fieldToStoreSizes]: sum,
});
}
Remember to write your correct base name and fields in the three first lines
It works form me. Hope this solve the question.
😉
Is it possible to put the result in a text field with a unit? What file size unit does your script put into the number field?
Is it possible to put the result in a text field with a unit? What file size unit does your script put into the number field?
@easecomm yes it is possible I did that in two parts (but you can use just one formula field to do that:
- First I have a column called sizeMB that converts the number to MB: Using this formula [
Is it possible, also, to do that inside the script, but airtable formulas work quite fast that i prefer this method.
Hope you find this helpful.
😉
I write this script into an automation. When an attachment field is updated, it gets the sum of all the files in the attachment field and put it into a number type field.
const table = base.getTable('Your Table Name');
const fieldWithAttachments = 'Attachments Field Name';
const fieldToStoreSizes = 'Sizes Field Name';
// Retrieve the specific record based on the provided recordId
const recordId = input.config().recordId;
const record = await table.selectRecordsAsync({ recordIds: [recordId] });
const selectedRecord = record.records[0];
const attachments = selectedRecord.getCellValue(fieldWithAttachments);
if (attachments) {
// Iterate over each attachment in the field
const sizes = attachments.map((attachment) => attachment.size || 0);
const sum = sizes.reduce((acc, curr) => acc + curr, 0);
// Update the sizes field with the calculated sum
await table.updateRecordAsync(selectedRecord, {
[fieldToStoreSizes]: sum,
});
}
Remember to write your correct base name and fields in the three first lines
It works form me. Hope this solve the question.
😉
Dear Alvaro, thanks for sharing your automation script. I wonder if you can assist me with troubleshooting the error I am seeing.
Thanks,
Mike
Dear Alvaro, thanks for sharing your automation script. I wonder if you can assist me with troubleshooting the error I am seeing.
Thanks,
Mike
Dear @Mike_Gendel :
The error message is indicating that recordId is undefined when it's being used in the selectRecordsAsync function. This could be because input.config().recordId is not returning a value.
To fix this, you need to ensure that recordId is defined before it's used. You could add a check to see if recordId is defined and throw an error if it's not.
In this case, whe we are running a script inside an Automation, we need to set Input Variables here:
That's why your script is giving you an error. And if you had already declare recordId variable. Please be sure that the names are exactly the same.
Hope this helps you!
Dear @Mike_Gendel :
The error message is indicating that recordId is undefined when it's being used in the selectRecordsAsync function. This could be because input.config().recordId is not returning a value.
To fix this, you need to ensure that recordId is defined before it's used. You could add a check to see if recordId is defined and throw an error if it's not.
In this case, whe we are running a script inside an Automation, we need to set Input Variables here:
That's why your script is giving you an error. And if you had already declare recordId variable. Please be sure that the names are exactly the same.
Hope this helps you!
Thanks. I replicated your settings but I still have an error. What am I missing? (By the way, as you can see, I am not an expert in scripting!)
Thanks. I replicated your settings but I still have an error. What am I missing? (By the way, as you can see, I am not an expert in scripting!)
hi everyone
Mike I have the solution for you, the place where you input the variable is case sensitive, you should write recordId and not recordid (the last I should be caps). I had the same problem and I solve it just like that.
Alvaro, sos un genio crack, really its amazing, you just save me 50 USD of miniextensions. works as a charm, if you ever read this message write me I would like you to work with me hehe
Dear @Mike_Gendel :
The error message is indicating that recordId is undefined when it's being used in the selectRecordsAsync function. This could be because input.config().recordId is not returning a value.
To fix this, you need to ensure that recordId is defined before it's used. You could add a check to see if recordId is defined and throw an error if it's not.
In this case, whe we are running a script inside an Automation, we need to set Input Variables here:
That's why your script is giving you an error. And if you had already declare recordId variable. Please be sure that the names are exactly the same.
Hope this helps you!
This is great, it works! But only for the one record that was tested in the automation setup screen.
Excuse the dumb question but how do I set the automation to run for all records in a table?
This is great, it works! But only for the one record that was tested in the automation setup screen.
Excuse the dumb question but how do I set the automation to run for all records in a table?
Never mind. Learnt that automations don't run on historical records with matching pre-existing automation conditions.
So I created a text field, added Automation trigger to match text field, let it run (on 15,000+ records), updated automation to remove that trigger, and delete the now redundant text field.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.