Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2565 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

In my DB I have a text file which tells me the size of audio and video clips as such 

927 KB or 1020 KB

and

27.5 MB or 15.26 MB

and 

2.01 GB or 11,3 GB

 

I used the following suggestion from this forum:

Mediasize::MediaSize * If ( PatternCount ( Convert Mediasize::MediaSize ; "GB" ) ; 1024 ; 1 )

but while it works fine with GB it doesnt work with MB or KB

Instead of doing a script a did a calculation as such

Case ( PatternCount ( Convert Mediasize::MediaSize ; "GB" ) ; Convert Mediasize::MediaSize* 1024; PatternCount ( Convert Mediasize::MediaSize ; "KB" ) ;  Left ( Convert Mediasize::MediaSize ; Length ( Convert Mediasize::MediaSize )  - 3) /1024^2  ; PatternCount ( Convert Mediasize::MediaSize ; "MB" ) ; "0,00" &  Substitute ( Left ( Convert Mediasize::MediaSize ; Length ( Convert Mediasize::MediaSize )  - 3) ; "." ; "" ) )

I used the Substitute function as in my country we use commas for decimals

however while the calculation works I get really large numbers for KB files and MB files

Is there a different way to calculate the text files to get regular number with perhaps a maximum of 3 decimals?

I could use it as a script or as a calculation defining the field

Thanks a lot and regards

Posted

Thanks for your interes and time. But .... How do I add it as a custom function to my FMPADV 13?

If I use it as a calculation or script FMP tells me it cannot find various fields and I am totally lost

Thanks again 

 

Posted (edited)

Thanks for your interest however even following step by step I am unable to create the external function

After I paste in New external function the code FMPADV 13 tells me I need to enter the function for:

 

 Floor ( Ln ( bytes ) / Ln ( _ratio ) ) 

It selects the word bytes and I am unable to continue as I am not skilled enough to do it 

Even if some kind person will help to find the "bytes" I am afraid I will run into some similar or different tasks which I won't know how to solve.

Thanks however

Dan

 

 

Edited by dkey
Posted

While you're editing the custom function, you need to set what the parameters are before the calculation will recognize the "bytes" and "precision" tokens, which would be undefined otherwise.

Screen Shot 2017-11-16 at 09.35.31.png

This topic is 2565 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.