Brian Dunning's FileMaker Custom Functions

ByteSize ( bytes ; precision )

Converts bytes to a magnitude-appropriate unit of measure

  Average rating: 4.4 (30 votes) Log in to vote

Jeremy Bante   Jeremy Bante

https://github.com/jbante/

Share on Facebook Share on Twitter

  Sample input:
ByteSize ( 618288209196180 ; 2 )
  Sample output:
562.33 TB

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Converts bytes to a magnitude-appropriate unit of measure.

 

Comments

belg4mit   belg4mit
Aug 22, 2022
To change 0 YB to 0 B for bytes=0, change the second magnitude line to:

~magnitude = Min ( Max(~magnitude ;0); 8 ) // don't exceed known magnitude units, and catch 0 bytes
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: