In this article we want to introduce you the new functions from the MBS FileMaker Plugin in version 14.4.
JSON
We have added a couple of JSON functions for you that you can use to create, update or delete records in your database. With the JSON.InsertOrUpdateRecordfunction, you even have the option of changing a data record if it already exists or creating a new one if it does not exist yet. With JSON.UpdateRecords and JSON.DeleteRecords, not only one record can be changed or deleted, but several records can be modified or removed at the same time. If you only want to create, change or delete one data record, you can use the JSON.InsertRecord, JSON.UpdateRecord or JSON.DeleteRecord functions. So that we know which data record we are addressing with JSON.UpdateRecord, for example, we first specify the file name in the parameters of the functions, as we get it from the FMfunction Get(FileName). This is followed by the table name and the primary key of the data record. For updating, we then also specify the value that we want to update.
MongoDB
For Mongo DB we have also added a new function. With MongoDB.CursorRecords we can output all MongoDB records as JSON from the cursor. This function loops and collects all records in a big JSON array. This gives you a high degree of portability to other applications.
Tidy your XML and HTML documents
With a few more functions that we would now like to introduce to you, you can bring tidiness to your XML and HTML files. With the function Text.Tidy you can pass an HTML or XML in the parameters. The function then performs a tidy over this XML or HTML and returns a corrected and tidy HTML or XML. For example, forgotten end tags or quotation marks are completed. To see exactly what has been changed and if warnings have been issued, call the Text.TidyErrorLogfunction. This provides you with an error log for the last tidy call.
Another new function from the HTML area is the Text.HTMLtoJSON function. This parses HTML and outputs it as JSON.
DynaPDF
We have also added a few new DynaPDF functions. You can now use the function DynaPDF.CreateExtGState to create an extended graphics state object from the structure GS. An extended graphics state can be used to adjust certain properties which are not part of the normal graphics state. Such properties can only be modified with a special PDF object called the Extended Graphics State. The most important properties of an extended graphics state are the transparency settings and the overprint control. Such a graphics state that you create with the function, we have just introduced, can then be activated with the DynaPDF.SetExtGState function.
We have also added the DynaPDF.CreateURIAction function for creating URI actions in this release. A uniform resource identifier (URI) is a string that identifies (resolves to) a resource on the internet - typically a file that is the destination of a hyperlink, although it can also resolve to a query or other entity. A URI action causes a URI to be resolved and this can be the action of a button for example. In the parameter you can specify a URL to be resolved.
Another new function is the DynaPDF.GetInEncryptionInfo function. This retrieves encryption settings of the currently active import file. As output we have a JSON that can contain the following keys with the following information:
Key | Description |
---|---|
Filter | Encryption filter |
HaveOpenPassword | If true, an open password was set. |
HaveOwnerPassword | If true, an owner password was set. |
Restrictions | What must be restricted? This is a bit mask and the very same value that DynaPDF.GetInEncryptionFlags returns. |
UnsafeOpenPwd | If true, the file can be easily decrypted by DynaPDF if DynaPDF.SetUseExactPwd is false. |
UnsafeOwnerPwd | f true, the file can be easily decrypted by DynaPDF if DynaPDF.SetUseExactPwd() is false. |
Matching this is the new function DynaPDF.TestPassword. The main purpose of the function is to test the file against the owner password if the encryption settings should be changed by the user. You specify the password to be tested and the type of password, whether owener or open password, in the parameters.
Syntax
There is also something new in our free goodie functions for Mac OS. You may already know that we have auto complete for variables that you have already used in your script. A list of possible variable names adapted to your previous input is displayed. In some cases it would be useful to see standard variable names that you always use in this list right from the beginning, without having used them in the script before. In this release we have added a function that allows you to set such a list of initial local variables: SyntaxColoring.AutoCompleteVariables.SetLocals. For global variables we had already added this possibility in the last release with SyntaxColoring.AutoCompleteVariables.SetGlobals. You can use the SyntaxColoring.AutoCompleteVariables.GetLocals function to query this list of intial local variables again.
Python
In the last release, we introduced you to the possibility of writing scripts in FileMaker using the Python programming language. In this release, we are adding a very powerful function to this area. With the Python.RunFile function, you can now also run a script in a separate Python file. This helps you to design more complex solutions very clearly and to outsource code, so scripts can be easily reused and exchanged.
XL
We would also like to introduce you to two new LibXL functions. With the new function XL.Book.RemovePrinterSettings you can remove the preset printer settings for an Excel workbook. You can also remove the VBA scripts, also known as macros, from an Excel file with the new XL.Book.RemoveVBA function. If there are printer settings or macros that have been removed by the functions, the appropriate function returns the value 1.
Webhook
With the new functions WebHook.GetTag, WebHook.SetTag, WebRequest.GetTag and WebRequest.SetTag you can now set tags for Webhooks and WebRequests and also read them out again. The tags are used to add any information to a webhook or a WebRequest, which can then be queried as needed. Such information could, for example, be a record ID that refers to an associated data record.
FieldStatistics
You may remember the function FM.RecordStatistics from our last release, which gives us statistics for a record. In this release, we have now added the FM.FieldStatistics function. This gives you the statistics for a single field. This can look like this for a container field, for example
We hope you will also find some interesting new features. We wish you a lot of fun with MBS FileMaker Plugin Version 14.4. If you need a license or have any questions, please contact us.