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

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

Recommended Posts

  • Newbies
Posted

I have data in multiple fields that needs manipulation.

Here are the fields:

Field 1: 50751327

Field 2: /MRW/Animation Episode 101/Audio Files/101act2_ADR.L.aif

Field 3: 560.083435058594

Field 1 is the file size in bytes, which I want to display in Megabytes instead, e.g.;) 48.4 MB.

Field 2 is the file path, but all I need from it is the file name, so I would like to trim everything out of the field except the last directory tree which is the filename, 101act2_ADR.L.aif

Field 3 is the time in seconds, which I want to display in minutes and seconds instead, e.g.:) 9:20

Can all this be done with script formulas? I could try manipulating the data with Applescript before it is imported into FM, but I don't know the extent of the FM scripting.

Thank you for any help...

Matthew Wood

Posted

This can all be accomplished using calculation functions. You could place the formulas in a Set Field step in a script if you want or simply use a Define Fields calculation field.

Converting bytes to megabytes can be done by dividing by 1,024 twice.

Grabbing the file name off the end of a path can be done with the following formula:

Right(

field 2,

Length(field 2) - Position(field 2, "/", 1, PatternCount(field 2, "/"))

)

Minutes and seconds can be determined from a quantity of seconds by dividing by 60 or the number of seconds in a minute. Use the Mode function to fogure out the remaining seconds that don't make up a full minute.

Posted

For Seconds try

Time ( 0 ; 0 ; timefield )

For Bytes try

Round ( bytesfield / 1048576 ; 1 )

For parsed file name try

RightValues ( Substitute ( path ; "/" ; "¶" ); 1 )

Posted

For Seconds try

Time ( 0 ; 0 ; timefield )

For Bytes try

Round ( bytesfield / 1048576 ; 1 )

For parsed file name try

RightValues ( Substitute ( path ; "/" ; "¶" ); 1 )

This solution will work great if you have FileMaker 7 or later. Matthew only has FileMaker 6.

Posted

Hiya John,

I apologize for that. I was trying to finish answering some questions while trying to run out of the office and go home last night. Overlooked the version. I didnt even realize that you had answered it already. Thank for the correction.

This topic is 6581 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.