In this article I want to introduce you the new functions from the MBS FileMaker Plugin in version 11.1.
Archive
With the new Archive.CompressContainer function you can compress the content of a container into an archive. In the parameters you can specify in which format your archive should be. The following formats are available for this purpose: 7zip, ar, arbsd, argnu, arsvr4, bsdtar, cd9660, cpio, gnutar, iso, iso9660, mtree, mtree-classic, newc, odc, oldtar, pax, paxr, posix, raw, rpax, shar, shardump, ustar, v7tar, v7, warc, xar and zip. Then you can additionally specify a filter at e.g. for zip format it can be store or deflate. We also need to specify the destination path, as well as the container from which the data is used. Furthermore we can specify other options like the compression level.
DynaPDF
Also in the DynaPDF component there is a new function that brings even more style into your tables. The DynaPDF.Table.SetCellStyledText function inserts the specified styled text into the cell. To do this, we first specify in the parameters the table ID, as well as the row and column. Now we can specify the alignment of the text horizontally and vertically, using the values left/bottom, center or right/top. Then we can set the text with the styles to be inserted into the cell. Optionally, you can specify the leading factor. If this factor is greater than 0, then the plugin will add \LD[] commands to styled text to set leading relative to font size. This way you define the spacing between lines.
An example of function usage may look like this:
Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellStyledText"; $table; $rowNum; 0; "left"; "bottom"; TextColor ( "Hello World" ; RGB ( 65535 ; 0 ; 0 ) ) ) ]
Files
With the new function Files.ReadAndWriteFile you can read a file and write it to another location. In the parameters you specify the path to the source file and the path to the destination. We already have a Files.CopyFile function, but there are situations where you don't want to simply copy a file, but need a replacement. In the Write operation, the file is read in 10MB blocks and written to the destination file. Meta information of the source file is not transferred.
Another function is the Files.FileNameWithoutExtension function. It returns the name of a file without specifying the file extension. This can be useful, if we load a file into a container and want to display the name of the file in another text field.
Dictionary
With the new function Dictionary.AddDictionary we can insert all entries of an already existing dictionary into a new dictionary. In the parameters we specify the reference of the old dictionary and the new dictionary, in which the values will be inserted. With the function Dictionary.FromJSON we can create a dictionary from a JSON. Thereby text and numbers are passed, null values remain empty and boolean values become numbers. Objects and arrays are passed as JSON.
List and Quick List
For list and Quick list we have new find functions. With List.Find and QuickList.Find we can find an entry in the list. In the Parameters we define the value that we want to look for. Optional we can define whether to ignore case. As result we get the index of a found entry or a minus one because the value was not found.
CURL
Also from the CURL area we have a new function. With the CURL.SetOptionAWSSigV4 function we can provides AWS V4 signature authentication on HTTP(S) header. We can pass a text that is the collection of specific arguments that are used for creating outgoing authentication headers. See documentation for details. This functionality is in addition to our existing CURL.SetupAWS function.