Skip 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.

Calculation that can return the file extension (.jpg) of a container image?

Featured Replies

How can I grab the file extension from a file that is placed into a container field?

 

Example of file names in my containers:

 

sales.report.2014.pdf

company.web-logo.svg

poster1.01-36.jpeg

t-shirt_2.06-hr1.jpg

 

My ultimate goal is to rename them and I want to make sure that the correct extension gets added to the new name.

Try this calc:

 

Let(

[url= GetAsText(YourContainerField);
lastdot = PatternCount ( url ; "." );
lastdotpos=Position(url; ".";1;lastdot);
urllength=Length(url)
];
Right(url; urllength-lastdotpos)
)
 
This presumes that the files are not externally stored.
  • Author

Thanks.

 

The file is externally stored. Can you please tell me what I would I need to change in your formula?

 

I am trying to get the file name using this calculation but it's not working. It returns a question mark.

GetContainerAttribute ( myContainerField ; "filename" )

Another possibility is this:

 

Let ( [
_fileName = GetValue ( GetAsText ( Table::containerField ) ; 1 ) ;
_values = Substitute ( _values ; "." ; ¶ ) ;
_count = ValueCount ( _values )
] ;
If ( _count > 1 ; GetValue ( _values ; _count ) )
)

Try this calc:

[ … ]

This presumes that the files are not externally stored.

 

Or this one:
Let (
url = Substitute ( GetAsText ( YourContainerField ) ; "." ; ¶ ) ;
RightWords ( url ; 1 )
)

EDIT: For v13, use

Let (
a = GetContainerAttribute ( yourContainerField ; "filename" ) ;
RightWords ( Substitute ( a ; "." ; ¶ ) ; 1 )
)
  • Author

Thanks guys. This worked for me:

 

Let (
a = GetContainerAttribute ( yourContainerField ; "filename" ) ;
RightWords ( Substitute ( a ; "." ; ¶ ) ; 1 )
)

I also discovered that GetContainerAttribute ( myContainerField ; "filename" ) was originally not working because my calculation was being stored.

 

 

jbante, I tried to use your formula but it kept telling me that "_values" could not be found and I was not sure how to resolve that.

  • Author

Do either of you know how to change the name of a remote container image that is being stored on a FileMaker 12 Advanced server? I am trying to do this from a Mac running FMPA 13. This seems a bit tricky to pull off. I think the best bet may be fore me to save the container image with the new name to my computer and then replace the current container image with the new one.

  • Author

I ended up creating a looping script that saved the files to a local folder and then replaced the remote container contents with the newly renamed image file. A little slow but it got the job done. :)

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.