MBS FileMaker Plugin 11.1

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.

1 Like

XML
With the new function XML.SetPathCData you can set path value with C Data. C Data sections tell a parser that no markup follows but normal text. Even if markup characters like <, > and & are included they are ignored by the parser. This function uses a path notation like the JSON functions in FileMaker to describe paths.

Here we see an example and its result:

MBS("XML.SetPathCData"; ""; "export¶person¶name"; 0; "John Miller“)

Example result:

<?xml version="1.0" encoding="UTF-8"?>

<![CDATA[John Miller]]>

Audit
With the new Audit.Hash function we can hash fields and values. This is basically an uppercase MD5 hash of an UTF-8 text. Here we can see an example:

MBS("Audit.Hash"; 123)

The result is „202CB962AC59075B964B07152D234B70“. We use the same hash technic like the FieldHash field in audit.

GraphicsMagick
We have two new functions for GraphicsMagick. With the GMImage.IsLoggingEnabled function we can check if the login of events is active.
With the GMImage.SetLogEventMask function we can decide which events are logged. We can choose between: none, Configure, Annotate, Render, Transform, Locale, Coder, X11, Cache, Blob, Deprecate, User, Resource, TemporaryFile, Exception, Option, Information, Warning, Error, FatalError and All
You can define this events in the parameters in a string separate by comma.

Set Variable [ $r ; Value: MBS( "GMImage.SetLogEventMask"; "coder,annotate" ) ]

By default, logging goes to stderr, so on macOS you may need to run your app via Terminal to see logs there.

It is also possible to disable logging. In this case we simply enter a „none“ in the parameters.

Set Variable [ $r ; Value: MBS( "GMImage.SetLogEventMask"; "none" ) ]

Speech
For several years now, you have the option of using the Speech component to give your solutions a voice. We have now added the new Speech.Stop function in this area that terminates the speech output as quickly as possible.

Math
We have two new functions in the topic Math. With the „Math.FormatNumber“ function we can formate a number. In the parameters we can set how many digits of precision the number should have, the decimal Separator (by default it is the current setting of FileMaker) and the thousands separator.
Here we have an example Script: We want the comma as decimal point and the dot as thousands separator. The result of the script you see in the dialog.

Set Variable [ $Number ; Value: 12346789,123456789 ]
Show Custom Dialog [ "Math.FormatNumber" ; MBS( "Math.FormatNumber"; $Number; 4; ","; "." ) ]

This function replaces the need for a custom function in our databases.


The second new function is the Math.NormInv function. With this function you can return the percentiles of the normal distribution for the specified arithmetic mean and standard deviation. In the parameters you set the Probability and optional the arithmetic mean and Standard deviation of the distribution. In this way the result of MBS("Math.NormInv"; 0,56; 5; 2) is 5.3019384309935544408. The NormInv function is calculated like in Excel.

Barcode
Next I would like to introduce the Barcode.Modulo10Checksum function. It calculates the checksums used in Swiss payment barcodes. The QR reference consists of 27 numbers. The last digit is the checksum. So you can enter the 26 digits and get the checksum. An example that gives us the answer 7 looks like this:
Set Variable [ $QRNum ; Value: "21000000000313947143000901" ]
Set Variable [ $checkDigit ; Value: MBS("Barcode.Modulo10Checksum"; $QRNum) ]

Now if we want to build the QR reference together, we merge the two numbers in the next step:

Show Custom Dialog [ "QR Reference" ; $QRNum & checkDigit ] ![|551x257](https://www.mbs-plugins.com/image/Plugin111QRReferenz.jpg) **IBAN** Let's stay with banking right now, because we have a new component: [IBAN](https://www.mbsplugins.eu/component_IBAN.shtml) functions. With this component you can validate international bank account numbers. The IBAN of each country has specific rules that must be met to be a valid IBAN. How these rules are defined, you can find out by specifying the country coded and use it with the function [IBAN.RegEx](https://www.mbsplugins.eu/IBANRegEx.shtml). For German URL the result would be: ^DE[0-9]{2}([0-9]{08})([0-9]{10}) That means first there is a DE for Germany, then follow 2 digits which can be from the range 0-9. These are the check digits. Then follows the 8 digit bank number and the 10 digit bank account number. With the function IBAN.IsValid you can make sure that the IBAN is a valid IBAN by passing the IBAN in the parameters. If you need a valid example IBAN for a country you can generate it with the IBAN.Example function by specifying the country code in the parameters. You can get a list of country codes with the IBAN.Countries function. If you have a bank number and a matching account number but you don't know the checksum then you can calculate the checksum with IBAN.CalcCheckSum. The example shows it to you:

Set Variable [ $routingNumber ; Value: "10010010" ]
Set Variable [ $bankAccountNumber ; Value: "0987654321" ]
Set Variable [ $CheckSumIBAN ; Value: "DE00" & $routingNumber & $bankAccountNumber ]
Set Variable [ $CheckSum ; Value: MBS("IBAN.CalcCheckSum"; $CheckSumIBAN) ]
Set Variable [ $IBAN ; Value: "DE"&$CheckSum & $routingNumber & $bankAccountNumber ]
If [ MBS("IBAN.IsValid"; $IBAN)=1 ]
Show Custom Dialog [ "The IBAN is Valid" ; "Unformatted it looks like this:¶ " & $IBAN & "¶¶¶Formatted it looks like this: ¶" & MBS("IBAN.For… ]
Else
Show Custom Dialog [ "Error" ; "Something go wrong! The Format should be:¶“ & MBS( "IBAN.RegEx"; "DE" ) & "¶But is:"&$IBAN ]
End If

You can see in the example, that we can also format the IBAN so that it is divided into blocks. For this we use the IBAN.Format function. If you want to remove all unnecessary characters from an IBAN, for example to extract the bank code, use the IBAN.Compact function. This function also ignore invalid characters in the input IBAN e.g. strip out dots, spaces or dashes.


Mac
There are also new features for Mac and the iOS SDK

New little helpers for Mac
We have many little helpers for Mac developers under FileMaker for a long time now. We extend these functionalities in this release too. You now have the possibility to display information about a field or variable as a tooltip in the debugger. In addition to the name of the field or variable, the type and the current value are displayed. Here a hint: Avoid using spaces in your field names, because the plugin can only read field names up to the first space. Also, spaces only make your work with SQL commands unnecessarily difficult.


Another cool new feature is the syntax check and evaluation test for calculations and custom functions dialogs. For this we have the two new buttons Execute and Check Syntax with a field in, which the result is displayed, in the two dialogs. For example you can write your own function and check for syntax errors. You will see if there was a syntax error and get information about where the error could be. If you want to test your own function you can set sample values in special comments (three slashes instead of two) and then display the result of the calculation in the field. The assignment of the values in the comments has no influence on the later use of the function.

Data Detector
Do you already know the feature of Apple's Mail application that suggests you to automatically add a date contained in the mail to your calendar, save flight data or add a phone number to your contacts? You can now apply the functionality of Appel Data Detector to your texts in your solution. This functionality is based on a Regular Expression and for this reason can be found in the RegEx section. In the function we can first specify the types to look for in the text. We can specify a combination of the following values for this parameter: Date, Address, Link, PhoneNumber or TransitInformation. These values are then separated by commas. In addition, we specify in the parameters the text to be analyzed. As result we get a JSON array which has for each found element an entry with different data. For example, for this step
MBS( "RegEx.DataDetector"; "PhoneNumber"; "Phone us at (555)555-555 later!" )

you get the matching JSON.

[
{
"length" : 12,
"position" : 13,
"text" : "(555)555-555",
"type" : "PhoneNumber",
"PhoneNumber" : "(555)555-555"
}
]

We get in this case the length of the found text, the position, the recognized text, the type and the phone number at self. For dates for example we get for example the duration of the meeting.

QuickLook


We have also good news for the QuickLook component. We have some new interesting functions for it. With QLPreviewPanel.SetDismissTrigger we set the trigger script that is called when a panel is dismissed. The function QLPreviewPanel.SetEditingAllowed allows the editing of a panel. In this way for example you can paint over an existing image or mark important parts. If we Show the panel you can see, if it is activate, a blue pencil in the right upper corner is shown. You surely know this function from Apple Photos.

With the new function QLPreviewPanel.SavedFiles you query a list of the file paths, that are saved. This function is for example useful if we want to change or delete the files.

iOSApp
We have also new functionalities for the topic iOSApp that set App wide settings for iOS applications. This time all the innovations revolve around URL. We can use the function iOSApp.InstallOpenURLHandler to instal the OpenURL handler. We need only do it once and then we can notify when a new Open URL request is sent to our iOS application. We can trigger a script that we set with iOSApp.SetDidOpenURLScript or evaluate an expression that we set with iOSApp.SetDidOpenURLEvaluate. With the iOSApp.LastURL we query the last URL that we received. In order to avoid unwanted errors, we can also clear the storage of the last URL by calling the function iOSApp.ClearLastURL.

Core Location
The new function CoreLocation.requestTemporaryFullAccuracyAuthorization ask for temporary access to the current location if we doesn't have permission to access accurate location.This access will expire automatically, but it won't expire while the user is still engaged with your app. So, for example, while your app is in the foreground your app will retain the temporary access it was granted.

Plugin
The new Plugin.PrepareForUpdate function prepares the plugin for an update.
The MBS FileMaker Plugin prevents FileMaker from unloading itself to avoid crashes with Cocoa runtime system. For example one plugin loads and registers a class. Then it may get deactivated and unloads. Later a newer plugin in a different version loads, and tries to use the class that was registered before. Since the first plugin is unload, all pointers are invalid and the application crashes. This function disables this feature, so a newer plugin may replace it when you update.

We hope you will also find some interesting new features. We wish you a lot of fun with MBS FileMaker Plugin Version 11.1. If you need a license or have any questions, please contact us.

by Stefanie Juchmes

1 Like

This feature is SUPER functional. Between this and the syntax coloring makes MBS a must have!

4 Likes

True @BoloMan28 , its a good help. I use it daily.

2 Likes

Welcome to the fmSoup @BoloMan28.
I find this new feature really useful too.

2 Likes

Please tell others :slight_smile:

1 Like