Changed Barcode.Generate to default to 8-bit per channel for the generated image to avoid trouble if receiving software can't handle 16 bit per channel. You can still change with GMImage.SetDepth, e.g. to make a monochrome version.
Today we looked into things for saving PDFs on server when using FileMaker Server for Linux.
First you need to know that whenever PDF creation fails, it seems to always return error 800. That is not helpful as the error is not about creating the file itself, but about assembling the PDF before writing it.
For example if you have a smiley 😀 in the text, you may see FileMaker on macOS ignore it. The smiley will be missing in saved PDF. But on Linux, we get an error 800 and PDF creation fails. Now you can use Text.FilterUTF16 function in our plugin to prepare all your texts and remove the emojis.
For the fonts itself, please be aware, that Linux comes with a different font list than macOS or Windows. And while you can install a Microsoft font package on Linux to get Arial, Wingdings and others, you may just relay on the font substitution done by the PDF engine in FileMaker on Linux. For example Arial will be converted to LiberationSans. Sadly font substitution doesn't work well for us and using Times or Capitals as fonts gives you error 800 again. Best may be to use PDF Standard Fonts.
We installed Jet Brains Mono font on the Linux machine by copying the font files into a new folder /usr/share/fonts/JetBrainsMono. Then we run the "fc-cache -f -v" command in Terminal to rebuild the font cache. Running "fc-list" shows the font list in Terminal. Once the font is installed and WebDirect noticed (we restarted the computer, but not sure whether it's required.), we successfully used the font for a label on a PDF created on the server.
You can use fonts on Linux for text, e.g. by evaluating TextFont ( "Hello" ; "Caladea" ). If you specify a font not available, it may fall back to the default font. Enjoy!
Did you know there is an EndOfLine class in Xojo?
You like a proof? Just run this code in a new project:
Dim e AsNew EndOfLine
Now you see the object in the debugger. This is of course an implementation detail and could change.
When you use EndOfLine in the code as value and not as class, you call a global function called EndOfLine returning the EndOfLine object. This is optimized and we can verify in the debugger that we get the same object each time. If you use it in a string operation, it may invoke one of the operator methods like Operator_Convert to get the string for the current platform.
The individual functions Android, LF, iOS, CR, Unix, macOS, CRLF, Windows are shared methods (or properties?) on the class. Update: Introspection shows those are shared properties, but computed. And they seem to be implemented differently, so some return the same string always, while others just create a new string each time.
Due to the fact that using EndOfLine invokes two functions to get the object and then the string, it makes sense to cache the value. A line like this may speed up access to EndOfLine :
Dim EndOfLine AsString = EndOfLine
Following access is at least double the speed, so if that is a bottleneck for you, you can optimize it! But only worth it, if you call EndOfLine a lot in loops within your code.
Wishes on Feedback
Looking into EndOfLine reminds me to two feature requests, I'd like to see implemented in a future Xojo version. Beside with EndOfLine, they could help us for our own code. All those shared properties could be real properties for the compiler, which could be marked to be read only for access from outside. For example a module could define them and in a Constructor for the module they could be assigned. So we need a kind of constructor for modules like in feedback case 24018. The constructor may only access things in the module and should be called before app.open. The properties could have an attribute to mark them public to get, but private to set. Like the idea in feedback case 49428. If this would be implemented, you could skip all those getter functions and the compiler could make much better code to just lookup the global EndOfLine property easier and skip it for the shared properties.
Let's say we would get those implemented and we could have a module like this:
StartDateTime = DateTime.Now
Property StartDateTime As DateTime Attribute ReadOnly
As said, constructors should be run before App.Open and prepare the module. The compiler would assemble list of modules and call Constructor methods if those exist. Per definition access to other framework methods is possible, but not to other modules as order of initialization would not be defined. Although compiler could sort module names of course and then order is defined!
Finally there is also a Text.EndOfLine global function, which returns you EndOfLine as Text data type. But be aware, that on iOS Text.EndOfLine and EndOfLine.IOS don't return the same result. One returns Chr(13) and one Chr(10).
You may know FileMaker has the possibility to save records as PDF to a file. From time to time clients ask how to script to get the PDF into a record. We like to show you a sample script on what you can do and run this either on server (e.g. triggered from FileMaker Go) or on client.
The script takes the record ID as parameter. We switche to the target layout and the correct record based on the record ID to setup the context. That's important as on a server we need to setup context ourselves. On a client you can skip this, if you know you are on the right record already. We build a file path for the temporary PDF document named "temp.pdf". On a server with multiple scripts running at the same time, you may better use temp folder or put a new unique UUID in the file name.
Next we ask FileMaker to save current record as PDF to the given file path. If that works and we don't get an error reported, we can use the Container.ReadFile function to read the PDF file. Please note, that we have different file path in either FileMaker style or native OS style for the plugin. If the read operation works, we can try to put the new PDF document into the field. If that works, we can commit changes to disk and report back OK. Per convention we have the script either return OK or an error message, so the calling script can check the result.
Here is the final script:
# pass record ID as parameter
Set Variable [ $RecordID ; Value: Get(ScriptParameter) ]
# go to target layout
Go to Layout [ “Contact Details” (Contacts) ; Animation: None ]
If [ Get(LastError) ≠ 0 ]
Exit Script [ Text Result: "Failed to go to layout!" ]
Go to Record/Request/Page [ With dialog: Off ; $RecordID ]
If [ Get(LastError) ≠ 0 ]
Exit Script [ Text Result: "Failed to go to record " & $recordID ]
# build a path for FileMaker
Set Variable [ $name ; Value: "temp.pdf" ]
Set Variable [ $path ; Value: Get(DocumentsPath) & $name ]
For this year's Thanksgiving in America, we offer again discounted licenses for our MBS Plugins for FileMaker and Xojo.
Please use coupon code BlackFriday for our web shop to order new licenses with a 20% discount. This includes DynaPDF and LibXL.
If you have special needs, you can email us to get an invoice or Paypal payment link directly. We know some people need to wait till next week to order, so the offer is valid till Tuesday.
Second if you have purchased previously an individual MBS Xojo Plugin part from the Complete Set within the last two years, but not the whole set, we offer you an upgrade to the Complete set for the update price. Please consider to get the whole collection of 40 plugins instead of just one plugin.
Have you checked the NSTextFinderMBS class for macOS to show a search field within a text area?
With a little code you can provide a find & replace toolbar within the text area like this:
The GUI is standard from macOS and localized by the system.
Here is the sample code you can use:
//getMBSobjectsfortheXojocontrolsDim textView As NSTextViewMBS = TextArea1.NSTextViewMBS
Dim scrollView As NSScrollViewMBS = TextArea1.NSScrollViewMBS
//firstrun,wecreatetheTextFinderobjectIf finder = NilThen
finder = New NSTextFinderMBS
finder.client = textView
finder.findBarContainer = scrollView
finder.incrementalSearchingEnabled = TrueEndIfIf CheckFindbar.Value Then//enablefindbarIf scrollView.FindBarVisible Then//showthefindinterface
ReturnEndIfIf textView.usesFindBar Then//showthefindinterface,ifitwashiddenbefore
scrollView.FindBarVisible = TrueReturnEndIf//enablesfindbar
textView.usesFindBar = TrueEndIfIf CheckFindbar.Value Then//showit
You may just have a menu command for search and when it's triggered, you can check what Window.Focus points to. If a text area is in focus, you can simply call the method above and pass the text area to show the find bar.
Please don't hesitate to contact us with your questions.
Dieses Jahr findet die fmnext.ch Veranstaltung online statt und über mehrere Wochen verteilt mit Vorträgen online:
Medio-Ingeno AG proudly presents FMnext - Screencasts 📽
ab 17. November 2020, 17 Uhr
Anstelle des jährlichen FMnext XP Events für Entwickler, FileMaker-Enthusiasten und Interessierte veröffentlichen wir
aus bekannten Gründen an dieser Stelle wöchentlich Screencasts aus der Community zum Thema Claris FileMaker ®.
Das Programm dieses Jahr:
Episode 1 - 17.11.20 Wie erstelle ich Add-ons in FileMaker 19?
In einem 20-Minuten Video wird das Erstellen eines Add-ons sowie der Einbau in eine bestehende Lösung Schritt für Schritt erklärt.
Referent: Martin Schwarz, Medio-Ingeno AG
Episode 2 - 24.11.20 Protokollieren von Datensatz-Änderungen: einfach und schnell
Michael Jupe zeigt, wie Änderungen am Datensatz protokolliert werden können, und zwar unmerklich für die Benutzer und unaufwändig für den Programmierer.
Referent: Michael Jupe, Medio-Ingeno AG
Episode 3 - 01.12.20 Subsummary Reports erstellen und exportieren
Zwischenergebnisse darstellen kann FileMaker seit langem. Weniger bekannt ist, dass die Daten dieser Subsummary Reports exportiert werden können. Das 20-minütige Video zeigt anhand einer Muster-Datei, wie ein Subsummary Report erstellt und exportiert wird.
Referent: Markus Spieler, Medio-Ingeno AG
Episode 4 - 08.12.20 Von UFOs und Card Windows
Card Windows bewegen sich in luftiger Höhe über ein anderes Layout und keiner weiss, von welchem Planeten sie stammen. Was bei Popover-Fenster in FileMaker noch klar ist, ändert sich radikal mit der Einführung von Card Windows. Frühere Beschränkungen werden aufgehoben und plötzlich sind ganz neue Arbeitsflusse umsetzbar. Da Card Windows nun auch mit WebDirect funktionieren, sollte man die Möglichkeiten kennen. Dieses Video ist eine kleine Flugschule für UFO's, die sogenannten Card Windows.
Referent: Karsten Risseeuw, Kursiv GmbH
Episode 5 - 15.12.20 Neues aus der Monkeybread Schmiede
Referent: Christian Schmitz, Monkeybread
Alle Videos finden Sie auf der fmnext.ch Webseite.
After an extended beta phase Xojo 2020r2 was released today. See announcement, Release Notes and download. This is a huge release, which implements a couple of points on the roadmap and brings us Apple Silicon support, plugins for iOS with iOS getting API 2.0 framework and new worker class and even a few new controls for search and date/time picker.
This Xojo version can build applications for Apple Silicon and it can build universal applications, too. We updated MBS Plugins and include Apple Silicon support there in version 20.5. You can try it, but we'll soon have a new beta for the next version as we find issues while more people try building for those new Macs with M1 processor.
All MBS Plugins in 20.5 (and future versions) include an Apple Silicon version. Not all libraries are available yet for Apple Silicon and most functions have not been tested although since it's basically the same code on the same OS with a compiler change, we expect everything to just works.
As you may know Americans love to shop on Black Friday and Cyber Monday. This year Black Friday is 27th November. About half our customers are in North America, so we are happy to offer you a discount if they buy this weekend. Our offer will go live in the next days and should be available in time.
We plan to offer coupon code BlackFriday for the web shop with 20% off for new licenses of MBS Plugins, DynaPDF and LibXL.
Updates are already offered with discount (usually 50%) compared to new purchases and and our academic prices already have a discount. If you like, you can email us to get an order link for all licenses you need or provide an invoice if needed.
As usual the discounted offer allows you to buy whatever licenses you may need in the next year. As you know that Apple Silicon is coming to a lot of clients next year, you may want to have current plugin licenses.
If you need a license from Xojo Inc. or their third-party store section, you may to check the Xojo store on the weekend. Everyone interested in a license for the next version 2020r2 featuring Apple Silicon support, should go and buy one.
For FileMaker there is still an offer available for buying one FileMaker Pro license and getting a free one to give away. This offer expires 18th December. If you or your client has an expired FileMaker license for over 6 months, you may get a discount for a welcome back offer with 25% reduced pricing. Also there may be possibilities to get a FileMaker Server for smaller companies with thee or four users.
You have a question? Please don't hesitate to contact us by email or phone. We may help to point you to the right offer.
In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 20.5.
Excel - News from the XL topic
Let's start with the innovations in the XL topic. With our plugins you can create and edit Excel documents via Xojo. In this release we have new features that extend the functionality of this topic. With the new method CopyColumn from the XLSheetMBS class you can copy the values of a column of a table into another column. This copying process is not limited to the worksheet or book. You can also copy columns between different books and sheets. In the last parameter of the method you can set the copy options. That means you can decide which type of content is copied. If that option is nil we copy everything.
An other new method is ReadValue from the XLSheetMBS class. With this method you read a value from a cell as variant. Depending on the content we return a number, a boolean, a text or a timestamp. Empty or error cells will return nil.
In this article I want to introduce you the new functions from the MBS FileMaker Plugin in version 10.5.
XL - Working with Excel
Let's start with the innovations in the XL topic. With our plugin you can create and edit Excel documents via FileMaker scripts. Also in this release we have new features that extend the functionality of this topic. With the new function XL.CopyColumn you can copy the values of a column of a table into another column. This copying process is not limited to the worksheet or book. You can also copy columns between different books and sheets. These must then be defined in the parameters.
You can use the XL.Sheet.AddDataValidation function to perform data validation for a specific area of a table. For example, you can specify that a column may not be empty or the values are in a range. These data validations can then be removed with XL.Sheet.RemoveDataValidations. This functions works for xlsx files.
The last but not least new function in the component is the XL.Sheet.CellReadValue function. With this function you reads a value from a cell. Depending on the content we return a number, a boolean, a text or a timestamp. Empty, blank or error cells will return an empty value.
Another new function is the Matrix.CSVSplit function. With this function we can convert a Comma Separate Value Text into a matrix. For example, if you have the data of a FileMaker database as a CSV file, you can use this function to easily write the data into a matrix and work with it.
Let us show you how to use Matrix.CSVSplit function for a custom CSV import. For example you may have a text file and read it with our Text.ReadTextFile function. Here it is important to know the text encoding to expect. Usually nowadays everyone uses UTF-8 except if you get data from ancient database systems with some Latin 1 or Windows ANSI encoding. Once you have some text, you may want to normalize line endings with Text.ReplaceNewline function.
Next you call Matrix.CSVSplit function to split the CSV text. We can pass the semicolon as delimiter. If you don't specify one, we auto detect whether it is comma, semicolon or tab character. But you can pass any delimiter you like here, e.g. # character. Once import is done, we can use Matrix.Height and Matrix.Width functions to query the size of the matrix we got. First row is the name of the fields. You may use the fields listed in the CSV later or bring your own field list for the insert operation later. And as we don't like to insert the field names, we remove first row with Matrix.RemoveRow function.
The magic to do inserts into your table is done with our Matrix.InsertRecords function. It creates internally an SQL statement to for insert operations. Then it walks over the matrix and runs SQL statement to insert records. If everything is fine, the function returns OK. Finally we can release the matrix object with the Matrix.Release function. You can see the SQL statement by calling FM.ExecuteSQL.LastSQL function.
Here is the sample script:
# native file path
Set Variable [ $path ; Value: "/Users/cs/Desktop/test.csv" ]
We got a handy function to query a type string for a variant. Useful when displaying variant content in our apps together with stringValue to get text representation. It uses our new GetVariantTypeMBS function to detect unsigned integer types.
The function is using BitwiseAnd to detect if the array bit is set and then BitwiseAnd with the ones complement to remove the bit for the type. For speed we use a dictionary filled on first call. And in case ever a new type is introduced, the break statement should stop in debugging and we can check the new type value and add it to the list.
Please let us know if you like it or have improvement ideas.