« MBS @ FMTraining.TV -… | Home | News from the MBS Xoj… »

New in MBS FileMaker Plugin 13.3

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

PDF Preview

With the new version of the plugin we have also added a new component that I would like to introduce to you today. With the Preview component you get a control for macOS and Windows that gives you a PDF preview in the layout. Since the plugin puts the control on the layout, it is independent of FileMaker, it can stay when switching records and can load data from a container field or from a file on disk. First you can use Preview.Available to check if the functions are available for your operating system. With the functions Preview.Create or Preview.CreateWithControl you can then create the control with a certain size defined in the parameters or with the help of a control. You get a reference number as return which you can use in the further functions. You can then load a PDF from a container with Preview.LoadContainer or from a file with Preview.LoadFile. With Preview.Unload you can then remove the file from the preview again. This and much more is waiting for you in this component, please have a look.

JSON

Also in the JSON area a few functions have been added to make your work easier. If you have many objects in a JSON array, it can be difficult to keep track of them. To make things a bit clearer we now have a function that will scan the array for you and filter the objects in the array by the filter criterion. The JSON.FilterObjectArray function. In this example, we filtered our array by the last name Miller.


Set Variable [ $JSONar ; Value: MBS("JSON.GetPathItem"; Test13.3::JSON; "Person"; 1) ] 
Set Variable [ $JSONFilter ; Value: MBS("JSON.FilterObjectArray"; $JSONar; "Name"; MBS("JSON.CreateString"; "Miller"); 1) ] 
Set Field [ Test13.3::Filter ; $JSONFilter ] 

We see that for strings we want to match we have to remember the quotation marks. We have a total of 3 people in our JSON array, two of them have the last name Miller. Our result looks like this:

[
	{
		"Name":	"Miller",
		"FirstName":	"Klaus",
		"Hobbies":	[
			"cooking", 
			"writing", 
			"watching TV"
		],
		"Dog":	{
			"Name":	"Lina",
			"Age":	2
		}
	}, 
	{
		"Name":	"Miller",
		"FirstName":	"Susann",
		"Hobbies":	[
			"backing", 
			"drawing", 
			"watching movies"
		],
		"Dog":	{
			"Name":	"Tina",
			"Age":	4
		}
	}
]

Another new possibility that improves your work with arrays is that you can now use JSON.GetArrayItemsAsQuickList to create a quicklist with the array entries, work with this quicklist, e.g. read, remove or add entries. Later you can turn this quicklist back into a JSON array using QuickList.JoinJSON. While we are on the subject of JSON, I would like to introduce our new function OCR.GetTextAsJSON. With the OCR component from our plugin you can recognize text from images. Also, until now you could get the position of the words as a list. From now on, if you call the function after the recognition, you can get a JSON containing the position of each word and the text style of each word. Here you can see a piece of such a JSON.

…
{
		"top":	92,
		"left":	36,
		"right":	96,
		"bottom":	116,
		"width":	60,
		"height":	24,
		"bold":	false,
		"italic":	false,
		"underlined":	false,
		"monospace":	false,
		"serif":	false,
		"smallcaps":	false,
		"pointsize":	7,
		"font":	316,
		"text":	"This"
	}, 
…

The function is intended to make it easier for you to retrieve this information.

Dyna PDF

There are also a few new features in the DynaPDF section.

We now have the possibility of submit and reset actions in interactive forms for you. With the functions DynaPDF.CreateSubmitAction and DynaPDF.CreateResetAction we can create these actions for selected fields or all fields. If you want to assign actions to selected fields only, or exclude fields for actions, then the new function DynaPDF.AddFieldToFormAction is your friend. The fields of the action can be included or excluded depending whether the flag Exclude was set or not.

The new DynaPDF.CreateAnnotAP function creates a user defined appearance stream for an annotation. and activates it so that arbitrary contents can be drawn into it, such as text, images, or vector graphics. An appearance stream is a normal template in the size of the annotation.

If we are already with templates, we come directly to two new functions. With the function DynaPDF.MarkTemplateAsWatermark you mark a template as watermark. It adds additional metadata to a template so that PDF editors like Adobe Acrobat are able to identify the template as watermark. Watermarks can be deleted with Acrobat and many other PDF editors. DynaPDF can delete such watermarks too with the new DynaPDF.DeleteWatermark function.

Since version 13.2 we already have the DynaPDF.OpenTag function which allows to open the specified tag so that contents can be written into it. To be able to pass even more information we now have the new function DynaPDF.OpenTagEx. Compared to the DynaPDF.OpenTag function we can pass additional parameters which can be set in a JSON like format.

The new function DynaPDF.AddDPartNode allows to add document part metadata directly in the PDF document. To use the function you have to create a DPartRoot dictionary first. For this purpose the function DynaPDF.CreateDPartRoot is available. Note that the function will fail if a DPartRoot dictionary was already imported or created by this function. You can check whether a DPartRoot dictionary exists with DynaPDF.HaveDPartRoot.

LibXL and Matrix

In the XL component, which deals with writing, reading and changing Excel documents without Excel installed, there are new functions. With the new methods XL.Sheet.SetColPx and XL.Sheet.SetRowPx we can set the column and row height in pixels.

Another new function XL.Sheet.CellWriteMatrix allows you to write a matrix created in FileMaker with the MBS Matrix component directly into an Excel document in one step. In the parameters we then specify not only the worksheet, but also the range of the table in which the matrix should be written.

In this context I would also like to introduce our new function Matrix.HTML. With this function you can get a HTML representation of a matrix, which you can display directly in a WebViewer, for example.

Schedules

There are also two new functions for scripts and SQL schedules running locally on the FileMaker desktop or in the iOS SDK. With Schedule.SetEnabled we can pause all schedules or resume all. In the parameters, we specify a 1 to continue and 0 to pause. With Schedule.GetEnabled we can test if the schedules are paused or not.

Delete files automatically

In this release we have also a function which can be useful for some of you, because with Files.DeleteLater we can create a list of paths which should be deleted after FileMaker is closed. This makes sense, for example, if you need to temporarily store a file from a container on disk to process it in a further step. e.g. you want to open a file from a container with Files.LaunchFile. You first have to put it as a file on disk so that you have a path that can then be passed to the launch function. The file remains unused after use. With Files.DeleteLater we now write it to the list. The file can be used in this session as you like and when you close FileMaker the file will be deleted. This way your computer stays tidy.

Text

With the new text function Text.ConcatWithDelimiter, you can easily compose your text from several words with a specified delimiter. For example, if you want to concatenate multiple names with a hyphen, your script step can look like this:

Set Variable [ $Text ; Value: MBS( "Text.ConcatWithDelimiter"; 
" - "; "Tanja"; "Marc";""; "Tina"; "Sam"; "Susanna";"Tom"  ) ] 

If you pass empty texts to the function in the word list, they are simply ignored, so you can save many If and Else If statements when assembling a string.

Read out attributes with GraphicsMagick

We have included a new image analysis feature for you in this release. The new GMImage.Describe function. This returns the attributes of an image without having to go through the console. In the paraments you can choose between three different detailed returns. If you specify a 1 or nothing in the parameter verbos, then you get the detailed return with the attributes to the image. If we specify a 0, we will get a short information about the image. If we specify a 2, then in addition to the information of the detailed variant you can read the number of colors from your image.

The new operating system Sonoma

In fall of 2023, version 14 of the new macOS operating system, Sonoma, will be released. So that you can check whether this operating system has been installed on a computer, we have already integrated the function SystemInfo.isSonoma in our plugin in preparation for this. This will give you a one if it is the new operating system.


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

25 07 23 - 11:16