Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

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.

Posted

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

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" )
Posted

Another possibility is this:

 

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

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 )
)
  • Thanks 1
Posted

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.

Posted

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.

Posted

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. :)

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