Jump to content

Recommended Posts

FileMaker 16 introduced a collection of built-in functions for manipulating data serialized as JSON. This makes it easier for FileMaker applications to interact with many web services. This will also make JSON the de facto standard format for scripts within FileMaker to pass parameters and results to each other, improving code sharing within the FileMaker community.

JSON does not have a broad palette of scalar data types to choose from: text, number, boolean, and null. Even with those, FileMaker's JSONGetElement function always returns a text result, even when the serialized JSON value is a number or boolean. So I made a handful of custom functions and scripts for sending and receiving typed data with JSON.

The module is hosted on GitHub, or you can download it directly.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By root_iv
      big hack#1 "JSON and FileMaker 16"
      https://t.me/filemaker_help January 25, 2018 In development process of information system definite records are required to be selected.
      For example, needed nomenclature could be added to shopping basket from product list.
        With 16 system release and adding functions JSON implementation of this task was greatly simplified. Earlier for user selects holding global field or supporting table was required. We had to follow that this field or table were emptied before every new  selection procedure. Only public variable is needed now. All information about selected records can be easily added and read by using function JSON,, where the result will be the following JSON- text:
      in which 1,3 and 4 – keys , which name corresponds to chosen identifier (if we chose record with id 1,3 and 4). Every key gets assigned the same boolean value: true.
      Script , applying data-hold in JSON-text, is simply arranged . Let us suppose, we handle button, by which the user choses certain record or unselects. Thus we decided to store JSON-text in public variable $$JSON.
      From the beginning we need to initialize JSON-text as it is not empty in initial state, it looks as : “{}”.   
      We can do it once in the script, prenex user’s work with recordset.  At this script item will appear : Set Variable [$$JSON; “{}”].
      But we can dispence with preliminary script. For example, we can perform such check each time,  user push the botton to  “select” record.
      The check will look so:
      If (IsEmpty ($$JSON);"{}";$$JSON)
      Later identifier value of current record can be accounted and memorized in variable $id_record.
      Set Variable [$id_record; GetLayoutObjectAttribute ("id";"content")]
      In order to item in script worked with using function GetLayoutObjectAttribute,  It is needed to place object on layout, displayed ID item, and name “id”.
      Then you make sure existence of tandem in
      JSON-text, whose name of key corresponds to identifier. If current record has identifier  5, we have to find tandem “5”:true. Here we use function JSONGetElement
      JSONGetElement($$JSON; $id_record)
      As such tandem doesn’t take place in our example, function returns  “empty”. It means this tandem needs to be added to JSON-text by function JSONSetElement
      JSONSetElement ($$JSON; $id_record), результатом будет запись в $$JSON: “{"1":true,"3":true,"4":true, "5":true}”
      If JSONGetElement($$JSON; $id_record) returns 1, it means that in text record is already considered. We need to do back action,- delete tandem from JSON by function
      JSONDeleteElement($$JSON; $id_record),  if
      $id_record was equal to 3, so tandem  "3":true,"  would be deleted and we would get:
      Thus , efforts are being made to fix and regulate chosen item in case of using JSON-function – minimum.
      Let us draw our conclusion. For implementation of this task we need:
      To create JSON-text in public variable $$JSON To check using function JSONGetElement, if value from  $id_record took place in $$JSON. If it there isn’t , needed value  from $id_record  should be added in $$JSON  using JSONSetElement If record  should be deleted from $$JSON, we use  JSONDeleteElement. Script "CheckButton" from MS.fmp12
      #Write the current value of the object named id Set Variable [ $record_id; Value:GetLayoutObjectAttribute ( "id";"content" ) ] #check if there is a JSON variable Set Variable [ $$MULTISELECT_LIST; Value:If (IsEmpty ($$MULTISELECT_LIST);"{}"; $$MULTISELECT_LIST ) ] #switch if the variable is empty then write, otherwise delete If [ JSONGetElement ( $$MULTISELECT_LIST;$record_id)] Set Variable [ $$MULTISELECT_LIST; Value: JSONDeleteElement ( $$MULTISELECT_LIST;$record_id )] Else Set Variable [ $$MULTISELECT_LIST; Value: JSONSetElement ( $$MULTISELECT_LIST;$record_id; 1; JSONBoolean) ] End If #refresh checkboxes Refresh Window Refresh Object [ Object Name: "checkbox" ] Download file MS.fmp12
      Invest in the development of our project
      We are ready to help in your development projects. Contact us and we will try to help you: artidog@gmail.com
    • By eXcelisys
      Hierarchical JSON Viewer / Editor
      By Andy Persons & Doug West
      One of the standout new features of FileMaker Pro 16 is native support for the JSON data-interchange format. In addition to providing easy integration with a host of online services, it also provides developers with the tools to create robust hierarchical structures for use entirely within FileMaker. This hierarchical JSON viewer / editor file provides some tools for visualizing, manipulating, and leveraging JSON text.
      Automatically creates a representation of any JSON text as a hierarchical portal of records, where individual elements can be expanded and collapsed Dynamically replicates changes to the hierarchical records in the JSON text, including add, edit, and delete actions Highlights the corresponding JSON element when a record is selected Applications
      Easily visualize large JSON text, collapsing nodes to focus on just the relevant sections. Manipulate JSON without needing to worry about the correct syntax Convert JSON returned from a web service directly into usable Filemaker records, customizing it to your needs Create and store hierarchical structures entirely in text (such as global variables), and display it as hierarchical records on the fly How it Works
      When JSON text is initially entered, the “JSON – Create Children” script retrieves the root keys using  JSONListKeys(), loops through the result, and creates the root records. When an element is eXpanded, the same script creates its child records if they don’t eXist and eXpands the hierarchy. When eXpand All is clicked, a similar script “JSON – Create All Descendants” loops through every element recursively and creates all descendants. Values for each record are retrieved and set using JSONGetElement(). To keep things streamlined, JSON key paths are used for the parent-child keys. Records are marked as arrays based on the presence of a left bracket (“[“) and formatted accordingly. Since JSONFormatElements() imposes a standard format, elements have a predictable number of leading and trailing lines. These are recorded in lines_leading and lines_trailing, respectively. They are then used in the Highlight Element script to calculate which part of the JSON text should be highlighted when an element record is clicked. Enjoy!
      •• Download - JSONViewer.fmp12 ••

      **This article is provided for free and as-is, use, enjoy, learn, and experiment at your own risk – but have fun! eXcelisys does not offer any free support or free assistance with any of the contents of this blog post. If you would like help or assistance, please consider retaining eXcelisys’ FileMaker Pro consulting & development services.
      About eXcelisys, Inc.: Founded in 2001, eXcelisys (www.excelisys.com)is an FBA Platinum Partner and FileMaker Certified developer organization. eXcelisys specializes in designing, developing, customizing, supporting, consulting, migrating, upgrading, fixing, and integrating of database solutions for Desktop, Mobile, and Web applications. Our core technology competencies are FileMaker Pro, FileMaker Go, and MySQL for database frameworks, along with FileMaker WebDirect, WordPress, MySQL, PHP, CodeIgniter, PostgreSQL, Joomla, Drupal, Magento, CSS, HTML5, and Javascript for web sites and web applications. Aside from providing eXcellent customer service, our goals are to use these technologies to intuitively automate your organization’s data solution needs seamlessly and flawlessly across the web, mobile, and desktop platforms. Contact eXcelisys today for a free estimate and consultation about making your business more efficient through intuitive and effective software automation. 866-592-9235.
      eXcelisys, Inc. is an independent entity and this web site/information/blog post has not been authorized, sponsored, or otherwise affiliated with FileMaker, Inc. FileMaker is a trademark of FileMaker, Inc., registered in the U.S. and other countries.
    • By jcarter
      Hi Guys,
      I've been using CloudMail for a couple of years now to send marketing campaigns for my company. Just recently I have moved to remote hosting with AWS and now my server is offsite I have noticed some performance issues with cloudmail and a few other areas of my solution.
      To address these issues I have started using server-side scripts to perform labour intensive tasks such as creating bulk records (20,000) at one time. This has resulted in excellent performance once again.
      The problem I can't seem to fix is sending my email campaigns using server-side scripts. I have confirmed the plugin is installed etc on the server and with quite a bit of trial and error, I am still unable to send the campaigns.
      Does anyone have a sample script they use, or any advise how I can get this working?
      I appreciate any help and thanks in advance
    • By Richard Carlton
      For this Coaches’ Corner tip, Kristian Olsen demos a simple technique for creating a popup menu in which you can make multiple selections. Very useful!
      Grab the sample file here:
      FileMaker Coaches' Corner - Tip 4 - Editable Popup Menu - Custom Function
      Most Recent Upload https://goo.gl/Dbn9fm
      Get up to speed with the FileMaker Pro 16 Video Training Course!
      Top Rated Course by FileMaker Expert, Richard Carlton.
      Experience Richard's dynamic and exciting teaching format, while learning both basic, intermediate, and advanced FileMaker development skills. With 26 years of FileMaker experience and a long time speaker at FileMaker's Developer Conference, Richard will teach you all the ins and outs of building FileMaker Solutions.
      The course is 50 hours of video content!
      Richard has been involved with the FileMaker platform since 1990 and has grown RCC into one of the largest top tier FileMaker consultancies worldwide.
      Richard works closely with RCC's staff: a team of 28 FileMaker developers and supporting web designers.
      He has offices in California, Nevada, and Texas.
      Richard has been a frequent speaker at the FileMaker Developers Conference on a variety of topics involving FileMaker for Startups and Entrepreneurs, and client-server integration.
      Richard is the Product Manager for FM Starting Point, the popular and most downloaded free FileMaker CRM Starter Solution.
      Looking for FM Starting Point free software download: http://www.fmstartingpoint.com
      Richard won 2015 Excellence Award from FileMaker Inc (Apple Inc) for outstanding video and product creation, leading to business development.
      RCC, Filemaker Videos, and LearningFileMaker.com are headquartered in Santa Clara, CA.
      Please feel free to contact us at support@rcconsulting.com
      FileMaker Pro is simply a powerful software used to create custom apps that work seamlessly across iPad, iPhone, Windows, Mac, and the web
      Transform your business with the FileMaker Platform
      Free FileMaker Training Videos Channel https://www.youtube.com/user/FileMakerVideos
      50 Hour FileMaker Pro 16 Video Training Course-FileMaker 16 News-Online FileMaker 16 Training Videos
      Playlist https://www.youtube.com/watch?v=KpQqLLDcZ8I&list=PLjTvUZtwtgBTMCfjM6LLwBAwGf_yXfvd_&index=13
      Top 10 New Features in FileMaker 16-FileMaker 16 News-FileMaker 16 Instructional Videos-FileMaker 16
      Playlist https://www.youtube.com/watch?v=urh8iHOCxkg&t=130s&index=1&list=PLjTvUZtwtgBTMCfjM6LLwBAwGf_yXfvd_
      Sharing your Database with Other Devices and Users-FileMaker 16 News-FileMaker 16 Database Sharing
      Playlist https://www.youtube.com/watch?v=GF82vkYtCtA&index=8&list=PLjTvUZtwtgBTMCfjM6LLwBAwGf_yXfvd_
      Introduction to FileMaker WebDirect 16-FileMaker 16 News-Online FileMaker 16 Training Videos
      Playlist https://www.youtube.com/watch?v=uaZKIpBjMAM&list=PLjTvUZtwtgBSVV1-4pFG4SHAhCIP3Yy-I&index=17&t=10s
      A database management system (DBMS) is a computer software application that interacts with the user, other applications, and the database itself to capture and analyze data
      Official site provides the SDK, Developer's Guide, Reference, and Android Market for the open source project
      Free FileMaker videos check out ...http://www.filemakervideos.com
      Download the FileMaker Pro 16 & FileMaker GO 16 for mobile devices training videos at http://www.learningfilemaker.com
      Download FileMaker Go 16 video training at http://learningfilemaker.com/FMGO-16/fmgo16.php
      Download FileMaker 16 Full Video Training Bundle at http://learningfilemaker.com/subscription.php
      FileMaker Video Training Review-FileMaker 16 Video Course Review-FileMaker Pro 16 101 Course Review
      Playlist https://www.youtube.com/watch?v=mF6Uor0KmKo&list=PLjTvUZtwtgBT8tNHuzF6cOKC_37zCTQl6&index=18
      Use FileMaker to create an app with the FileMaker Training Series
      FileMaker Pro is a cross-platform relational database application from FileMaker Inc.
      Comment, Like & Share Our Videos.
      Feel Free to Embed any of Our Videos on Your Blog or Website.
      Follow Us on Your Favorite Social Media
    • By naio
      My solution is build according to the 'separation model', so I would like to keep control of the local file containing the layout and presentation of the data hosted in the server.
      I wonder if I could have a script to control wether the local file gets its structure, layout or scripting modified, so I need a function to control when a change to the file has been made before giving it a version number. When the file gets open only to work with the hosted data it's not a new version.
  • Who Viewed the Topic


Important Information

By using this site, you agree to our Terms of Use.