« Find new records with… | Home | DynaPDF for iOS »

New in MBS FileMaker Plugin 11.2

In this article I want to introduce you the new functions from the MBS FileMaker Plugin in version 11.2.

In general we are ready for Apple Silicon as this plugin ships with arm64 code for macOS included. And our Linux version of plugin should load on Ubuntu. And for macOS in the Script Workspace we got option-click to jump right into calculation for set fields and variable script steps.

SQL

Let's start with the new functionalities from the component SQL. We got support in SQLite for ICU libraries. The SQL.InternalSQLiteLibrary.SetICUEnabled function enable or disable the use of ICU libraries. Suitably to this we have the function SQL.InternalSQLiteLibrary.ICUEnabled that queries whether ICU libraries are enabled. Normally we load them when SQLite initializes and we add the ICU extension if we find the library. But with the SQL.InternalSQLiteLibrary.LoadICU function we can explicit load them now. If we want to know whether the ICU libraries were loaded we can query the status with SQL.InternalSQLiteLibrary.ICULoaded. If we want to know whether the ICU libraries are used, we can use the SQL.InternalSQLiteLibrary.ICUUsed function. If this function returns 1, they are used. If they are not used we get a 0 as result.

We also have two new functions to convert timestamps between another database and FileMaker. A time, date or timestamp in FileMaker has a different format than a time in a SQL query. We can use the SQL.ConvertDateTimeToSQL function to convert a FileMaker time to a SQL time. The SQL.ConvertDateTimeFromSQL function does the opposite. It converts a time value that we get from SQL of another database into a format that is readable by FileMaker.

FM

You can also use SQL with the functions from the FMSQL Component into the FileMaker database itself. This component has been around since the early days of the plugin. In this version we have added two new features for you. The two new functions FM.InsertOrUpdateRecord4 and FM.InsertOrUpdateRecord5 are, as the name suggests, closely related to the FM.InsertOrUpdateRecord function. With these functions you can insert or update an entry in your FileMaker database with only one line. The special thing about the two new functions is that we can specify multiple comparison fields with values, so that the database entry that should be changed can be specified in more detail. In addition to the file and table name, we specify four or five field names and values that must match the named fields of the entry. Only then it change the field that we set also in the parameters and set the specified value. Thus, these functions are in a good tradition with the functions FM.InsertOrUpdateRecord2 and FM.InsertOrUpdateRecord3. For the Funktion FM.InsertOrUpdateRecord5, you can see an example here:

MBS( "FM.InsertOrUpdateRecord5";""; "Contacts"; "First"; "Christian"; "Last"; "Schmitz"; "Company"; "MBS"; "Title"; "Mr"; "Group"; "MBS"; "Fax"; "122345" )

Here we want to update a record that already has the following values:

Field Value
First Christian
Last Schmitz
Company MBS
Title Mr
Group MBS

In this record we change the field Fax. Its new value is „122345“

JavaScript

Our JavaScript functions can now use the new JS.InitModules function to define modules in JavaScript, which can then be referenced later with require. The new JS.InitModules function installs Duktape module loading. You must only call this function once for a new instance of the JavaScript engine and define your own Duktape.modSearch() to provide environment specific module lookups. After these steps, require() will be registered to the global object and the module system is ready to use.

Trace

We also have new features for the Trace component. Trace supports you in debugging your programs by logging all plugin calls in a text file, so that errors can be better detected and fixed. You can enable Trace at the beginning of your program to record all calls. With the new functions Trace.Pause and Trace.Resume we can stop and restart this recording. This can be useful if you do not want to log a certain part of your program. With Trace.IsEnabled you can check if Trace is switched on and with Trace.IsPaused you can check if logging is paused. In the earliest trace function, Trace, you can specify in the parameters the path to the file in which the calls are logged. With the new function Trace.Path you can also query the current storage location of the log text file.

Process

With the new function Process.List we can list all running applications on a Mac/PC. As result we get a JSON text with information about the processes. MacOS and Windows manage processes differently, so we have same and different fields.

FieldDescription
activeWhether application is active/frontmost.
hiddenWhether application is hidden on macOS.
executableArchitectureThe architecture on macOS, e.g. X86_64 or ARM64.
bundleIdentifierThe bundle identifier on macOS.
executablePathThe file path to the application. Not available on Windows for system processes.
currentWhether this is current process.
executableNameThe name of the app.
localizedNameThe localized name on macOS for the application.
processIdentifierThe process identifier number.
numberOfThreadsThe number of threads on Windows.
parentProcessIdentifierThe parent process identifier on Windows.

Time

The new Time.Wait function freezes time for you, or at least your script. When you call this function, your script stops for the specified number of milliseconds and then continues to run. So if you enter a 1000 in the parameters, so the function stops the script for 1 second.

Set Variable [ $Start ; Value: Get ( CurrentTimeUTCMilliseconds ) ] 
Set Variable [ $r ; Value: MBS( "Time.Wait" ; 2000) ] 
Set Variable [ $Stop ; Value: Get ( CurrentTimeUTCMilliseconds ) ] 
Show Custom Dialog [ "Time" ; "Time we start the script in UTC Time: " & $Start & "¶Time after a two second stop: " & $Stop & "¶The diffence is " & $Stop-$Start & " Milliseconds" ] 

List Dialog

We also have a few new features for the list dialog. Because from this version you can determine the alignment of the text for each column in the list dialog with the function ListDialog.SetColumnAlignment. To do this, specify the index of the column in the parameters and then the appropriate number for the text alignment. For example, a 0 followed by a two in the parameters means that the first column of the list dialog has a centered text. The ListDialog.SetColumnWidth function sets the width of a single column.

DynaPDF

The new DynaPDF.ChangeFontEx function from the DynaPDF component can change the font size of a font that has been previously defined. The function DynaPDF.SetFont for example returns a font handler when it is called. We can then specify this in the parameters of the new DynaPDF.ChangeFontEx function. We can specify the font size and style that we want to use for the next text lines. The font remains the same but the size change. The style flags should be the same as in the initial DynaPDF.SetFont call with exception of the flags Underline or Striked which can be used to underline or strikeout text.

Excel

If you like a font in an Excel folder, you can simply copy it to another document using the XL.Book.AddFontFromBook function. The function copies an already existing font definition from a document and copies tt into the target document by adopting the properties.

The new XL.Book.AddFormatFromBook function copies the format definition from one document to another. We also have in this component the new XL.CopyCellValue function that copies the value of a cell to another cell. In the parameters we specify the source and destination document, the worksheet and row and column of the cell. In addition, we can specify a constant that determines under which conditions content should be skipped or properties of a cell should not be copied. For example, you can prevent the copying of a format of a cell if you specify the constant SkipFormats in the parameters.

We have the function XL.Sheet.SetRows to set row height and format for multiple rows. In the parameters we set after the work book and the sheet index the range of the rows that should change by the index of the first row and the last row. Then we set the row hight and the index of the format.

Mac

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

The new function Container.ReadImageFile cannot only read a file from a path and return this file as a container value, but it also converts this file into the desired format. The function can read all formats supported by Apple's frameworks and output the image as JPEG, PNG, GIF or BMP. Therefore the function is especially useful to convert old PICT or new HEIC and HEIF images.

From the debugger section we have a small new feature. With the Debugger.IsDataViewerVisible function you can check if the data viewer is currently open.

Our plugin now ships with Apple Silicon support included. Claris announced they will support Apple M1 chip soon, so we are ready.

Windows

There is also new gerate functionality for Windows

Remote Control

With the new function RemoteControl.GetWindowsListAsJSON we get a list of all windows as JSON. In the parameters we can additionally specify a filter that filters the elements of the list by class name.

System Info

We have new features for the System Info component. You can now use the SystemInfo.WindowsSystemInfo function to retrieve information about the system that’s running on the machine for Windows-based systems. You can also now use the SystemInfo.WindowsMachineInfo function to retrieve technical information on a Windows machine. Both functions return a JSON as result. It holds the information in elements.

Linux

We are pleased to announce the first feature in our plugin that was written exclusively for the Linux platform. The SystemInfo.LinuxSystemInfo function queries Linux system information details and return this various information about the linux environment as JSON.

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

26 05 21 - 14:51