Aller au contenu
  • billets
    94
  • commentaires
    3
  • vues
    4 021

JavaScript Changes in FileMaker 16

Soliant Consulting

88 vues

FileMaker 16 introduces a new security setting that could affect solutions using JavaScript. This extended privilege is called "fmpurlscript" and allows URLs to perform FileMaker Scripts. The "fmpurl" is used to reference FileMaker applications, much like "http" is for referencing web applications. You can use an "fmpurl" with JavaScript to get information from a web script to your FileMaker application.

We have covered FileMaker and JavaScript before. Here are just a few previous blog posts and sample files:

DevCon 2017 Session

Jeremy Brown has an upcoming session at DevCon this year as well, where he will go into more depth on this topic. See more here.

Web Viewer Integrations Presentation Description

The web viewer object is an extremely versatile object that allows a developer to integrate deeper functionality into a custom app using the languages of the web, HTML/CSS and JavaScript.

In this session, you'll explore a standard way to integrate common web libraries, including setting up an integration in FileMaker, manipulating it, and gathering data using some of the new functions of FileMaker 16. Discover best practices that are used to make this as easy as possible to set up deeper functionality.

 

New FileMaker 16 Functions

FileMaker 16 also comes with helpful functionality for getting data back and forth from a JavaScript-based solution. These include functions for JSON (JavaScript Object Notation), which you can now handle natively in FileMaker. For more on these, please see the following blog posts from my team members:

Also, Makah Encarnacao has a DevCon 2017 session on JSON that may be of interest as well.  See more about that here.

Leveraging JSON in Your Custom Apps

JSON is a data language that’s becoming increasingly popular in the tech world and you can integrate JSON with FileMaker for your data interchanging needs.

In this session, you'll learn the various ways in which to leverage JSON in your custom apps. Take real world examples and investigate integration capabilities by contrasting FileMaker 15 (without plugins and 3rd party tools) and FileMaker 16 (using 16’s new JSON functions), including approaches for dealing with improperly formatted JSON. Recommended Background.

Updated JavaScript Samples for FileMaker 16

This new release has been a great opportunity to update a few examples I have written that use JavaScript. These are also freely available.

These particular examples demonstrate techniques that do not output a visible result in a Web Viewer. Rather, they utilize JavaScript functionality to extend FileMaker and return data to FileMaker in a useful way.

Each of these has been updated for FileMaker 16.

FM-js_Barcode

https://github.com/SoliantMike/FM-js_Barcode

A question posed in the FileMaker Community asked if there was a way to save an image generated from JavaScript and save it in a container field. This solution uses code from the Github repository of Johan Lindell, linked below.

Since storing as an image in a container field allows for clean printing in all platforms that FileMaker supports, this is a preferred way to generate and store barcodes. You don’t need to install anything on client machines, like 3rd party plugins or maintained fonts.

  • Github Project used here.

Some barcode types may have requirements on the values they can represent. For example, your EAN type must be a 13 digit number. Check the documentation for the barcode type you use before implementing this in your solution.

FileMaker 16 also added better support for Windows versions where long URLs are not supported and may fail. Note that this uses the user clipboard to transfer data from the web viewer to a field.

FM-jsSON

https://github.com/SoliantMike/FM-jsJSON

This file uses JavaScript to parse JSON. Since JSON was built specifically to be used by JavaScript, it makes sense to utilize the JavaScript engine via the Web Viewer in Filemaker Pro and FileMaker Go.

You can easily adapt this to your solutions as needed. There are minimal fields involved, and a couple scripts that drive the solution.

To run the demo:

  1. Modify the object you want to reference in the field provided. Note that arrays start at zero (0).
  2. Click the "Get Object" button.
  3. View the results.

The JavaScript used is in the Resources table, and you can modify it for your use from there.

FM-js_ExcelSheets

https://github.com/SoliantMike/FM-js_ExcelSheets

This file uses JavaScript to create an XLSX file. You can easily adapt it to your solutions as needed. There are minimal fields involved, and a couple scripts that drive the solution.

To run the demo:

  1. Check the boxes to select the sheets to include in your Worksheet.
  2. Click the "Save as Excel" button.
  3. View the results. If "Automatically Open" was checked, a copy is exported to the desktop and launched.

The JavaScript used is in the Resources table; you can modify it for your use from there.

Use the JavaScript Library from Github here.

Please view the licensing information for each piece.

FM-js_ValidateXML

https://github.com/SoliantMike/FM-js_ValidateXML

A question posed in the FileMaker Community asked if there was a way to validate XML. Interestingly, there are solutions for this in JavaScript that we can use to pass a result back to a FileMaker script.

By adjusting some JavaScript related to finding unclosed tags in XML, you can have it use a FMP URL to call a script in the parent FileMaker file and pass the result back as a script parameter.

See a sample JavaScript from Stack Overflow here.


The source URL referenced on the Stack Overflow page no longer works; use the XML Validator instead.

The post JavaScript Changes in FileMaker 16 appeared first on Soliant Consulting.


Afficher la totalité du billet



0 Commentaire


Commentaires recommandés

Il n’y a aucun commentaire à afficher.

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant

×