Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Text manipulation with scripts

Featured Replies

  • Newbies

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

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.

For Seconds try

Time ( 0 ; 0 ; timefield )

For Bytes try

Round ( bytesfield / 1048576 ; 1 )

For parsed file name try

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

  • Author
  • Newbies

Thank you all very much, these solutions worked great! Kudos again to a very helpful and motivated forum!

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.

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.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.