Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Container.Rename

Renames the file path in a container value.

Component Version macOS Windows Linux Server iOS SDK
Container 3.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Container.Rename"; Container; name )   More

Parameters

Parameter Description Example
Container The container field or value to inspect.
name New file name or new path list. "test.jpg"

Result

Returns modified container value or error.

Description

Renames the file path in a container value.
Does only work for normal containers, not with referenced files.

This is more efficient than combining Base64Encode/Decode since our plugin just changes the name metadata and leaves the data in place.
For external containers, FileMaker renames the file when the plugin renames the metadata. Or it writes a new file and later deletes old file. Later may be when FileMaker quits.

Examples

Renames an image to have a new file extension.

$oldname = MBS( "Container.GetName"; $container )
$newname = substitute($oldname; ".jpg"; ".png")
$newcontainer = MBS( "Container.Rename"; $container; $newname )

Rename external saved container:

#rename field container into variable
Set Variable [$newContainer; Value:MBS( "Container.Rename"; test::file; "test.txt" )]
#Put new container in field
Set Field [test::file; $newContainer]
#write changes to disk
Commit Records/Requests []

Rename a container field:

Set Field [ Anlagen::Bild ; MBS( "Container.Rename"; Anlagen::Bild; "new.jpg" ) ]
// with secure storage it was "remote:old.jpg" before and after rename it is "remote:new.jpg"
// with open storage it also writes new file and later FileMaker deletes the file when FMP closes.

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 11st June 2021


Container.RemovePreview - Container.RenameStream