Help

Re: Formula for files size in attachment filed

1972 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Forms_PTA
4 - Data Explorer
4 - Data Explorer

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.

18 Replies 18

This worked great for me, thank you so much! 

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 [

IF(Tamano,Tamano/1000000,0)] I use the if to avoid ERROR! when the attachment field is empty
Alvaro_Hernande_0-1706597699863.png

 

-Second, I append MB to the number: [
SUBSTITUTE((ROUND(TamanoMB,2) & " MB"),".",",") Here I add MB at the ende of the string and because I am at Europe, I change the "." with a "," for the decimals.]
 
Alvaro_Hernande_1-1706597722662.png

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.

😉

 

Dear Alvaro, thanks for sharing your automation script. I wonder if you can assist me with troubleshooting the error I am seeing.

Thanks,

MikeScreenshot 2024-02-26 at 11.56.03 AM.png

 

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:

Alvaro_Hernande_0-1708942124101.png

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!)

Screenshot 2024-02-26 at 12.33.22 PM.png

 

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

TristanARG_0-1710684350339.png

 

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.