• Facebook
  • Skype
  • Mail
  • Linkedin
Providing Custom Business Apps since 2014
Bespoke Business Apps
  • Home
  • Development
  • Our Work
  • Our Story
  • Latest News
  • Free Consultation
  • Search
  • Menu

Latest News

Our latest ramblings.

FileMaker Data API and Portal Filters

May 24, 2019/0 Comments/in FileMaker /by StevenAdmin

We’re currently working on a project where we are exposing the FileMaker Data API to some web technologies. The team working on the Web side of things have asked for the portal data passed back by the Data API to be filtered between a date range.

To do this with a relationship would mean having the current date in every parent record and we’d need to update this daily. Not the smartest way but it would work.

However we wondered if portal filters would work and sure enough the JSON passed back by the Data API was filtered based on the portal filter we placed on the layout.

tldr; You can use portal filters on a FileMaker layout and this will translate over to the FileMaker Data API response.

We also discovered that if you give your portal an object name, this too will be reflected in the Data API response object

{
 "response": {
  "data": [
   {
    "fieldData": {...},
    "portalData": {
     portalLayoutObjectName: [...],
    },
    ...
   },
   {...}
  ]
 },
 "messages": {...}
 "fieldData": "...",
 "portalData": 
 ...
}

A CSV Parser that converts CSV into JSON on the FileMaker Pro Platform.

fm-csv2json

April 9, 2019/0 Comments/in FileMaker /by StevenAdmin

A CSV Parser that converts CSV into JSON on the FileMaker Pro Platform.

I was browsing over at the FileMaker forums and came across a question about parsing CSV data.

This caught our interest and made us ask the question.

Could we take some CSV data and transform it into a valid JSON Object?

The answer was yes and with that we present fm-csv2json.

A FileMaker script which when passed a valid CSV string, will covert this string into a JSON object.

Download free over on Github.

We also have a similar parser that turns XML into JSON too.

fm-xml2json

FileMaker Web Direct Clock

April 9, 2019/0 Comments/in FileMaker /by StevenAdmin

I was browsing over at /r/filemaker/ and came across the following thread.

I’ve got a running clock javascript that works when opening from Filemaker, but can’t run correctly on webdirect because of the GetDate() function. I was wondering if anyone had a solution to pulling the date from the server so the clock will be uniform everywhere.

ltlmanandy

After spending about an hour or so playing around, to see if we could actually build a running Filemaker Web Direct clock. We produced the following solution:

Let (
  [
    _ts = 
      ( GetAsNumber ( Get ( CurrentHostTimestamp ) ) 
      - GetAsNumber ( Timestamp ( "1/1/1970" ; "00:00:00" ) ) 
      + Floor ( Get ( CurrentTimeUTCMilliseconds ) / 1000 ) 
      - GetAsNumber ( Get ( CurrentTimestamp ) ) ) * 1000 ;
    _html = 
      "
      <!DOCTYPE html>
        <html>
          <head>
            <script>
              function startTime(today) {
                var start = new Date(" & _ts & ");
                setInterval(function(){
                  /* delta is used to reduce time slippage */
                  var delta = new Date() - start;
                  if(today) {
                    var today = new Date(
                      today.getFullYear(), 
                      today.getMonth(), 
                      today.getDate(), 
                      today.getHours(), 
                      today.getMinutes(), 
                      today.getSeconds(), 
                      today.getMilliseconds() + delta
                    );
                  } else {
                    var today = new Date(
                      start.getFullYear(), 
                      start.getMonth(), 
                      start.getDate(), 
                      start.getHours(), 
                      start.getMinutes(), 
                      start.getSeconds(), 
                      start.getMilliseconds() + delta
                    );
                  }
                  var h = today.getHours();
                  var m = today.getMinutes();
                  var s = today.getSeconds();
                  m = checkTime(m);
                  s = checkTime(s);
                  document.getElementById('txt').innerHTML =
                  h + ':' + m + ':' + s;
                }, 100);
              }
              function checkTime(i) {
                if (i < 10) {i = '0' + i};
                return i;
              }
            </script>
          </head>
          <body onload='startTime()'>
            <div id='txt'></div>
          </body>
        </html>
        " ;
    _result = 
      Case (
        PatternCount ( Get ( ApplicationVersion ) ; "Web" ) ;
          "data:text/html;base64," & Base64Encode ( _html ) ;
        "data:text/html," & _html
      )
  ] ;

  _result
)

Paste the above code into any web viewer and it will produce the following FileMaker Web Direct Clock!

Filemaker Web Direct Clock

The script makes use of Get ( CurrentHostTimestamp ). This keeps any client, whether using web direct or FileMaker Pro, in sync as the time source is consistent between clients.

The _ts variable is used to convert a FileMaker Timestamp into an Epoch timestamp required in Javascript.

The javascript var delta is required because the javascript function setInterval(...) is not guaranteed to consistently run at the ms value you give it. This variable allows for the slippage to be calculated and be added or subtracted to the time to keep it in sync. We initially didn’t have this and noticed that within 5 minutes our web direct clock and our system clock where out of sync by a matter of minutes.

References

Get ( CurrentHostTimestamp ): https://fmhelp.filemaker.com/help/17/fmp/en/index.html#page/FMP_Help/get-currenthosttimestamp.html

FileMaker Epoch Method: https://community.filemaker.com/thread/93917

Javascript Clock:https://www.w3schools.com/jS/tryit.asp?filename=tryjs_timing_clock

Javascript timer slippage: https://stackoverflow.com/questions/29971898/how-to-create-an-accurate-timer-in-javascript

https://www.soliantconsulting.com/blog/display-complex-web-viewers-in-webdirect
get-mime-types-with-filemaker

fm-mime-types

April 3, 2019/1 Comment/in fmapi /by StevenAdmin

As we delved into the world of REST APIs using FileMaker, we stumbled across an issue.

How do we get a file’s MIME-type in FileMaker Pro?

When you are dealing with binary data and having to send HTTP Headers in relation to this data, you will most certainly have to provide a Content-Type header at some point.

This header tells the recipient the type of information that is being passed over the network.

e.g. A pdf file will have the Content-Type of application/pdf.

We found out during our development of fmapi-aws-s3 that to put data onto an S3 bucket, we would have to pass in the MIME-type of the file we send.

This was an issue and with any issue, solutions are born.

We present fm-mime-types.

A FileMaker script which when passed a valid filename, will return the correct MIME-type for that file format.

Download free over on Github.

An XML Parser that converts XML into JSON on the FileMaker Pro Platform.

fm-xml2json

March 30, 2019/4 Comments/in fmapi /by StevenAdmin

An XML Parser that converts XML into JSON on the FileMaker Pro Platform.

As we delved into the world of REST APIs using FileMaker, we stumbled across an issue.

How do we handle XML responses?

When the REST response is a JSON object, we don’t have any issue and can make use of the JSON functions introduced in FileMaker 16 to manipulate that response as we need.

However, we found out during our development of fmapi-aws-s3 that REST APIs can respond in XML.

This was an issue and with any issue, solutions are born.

We present fm-xml2json.

A FileMaker script which when passed a valid XML string, will covert this string into a JSON object.

Download free over on Github.

We’re LIVE!

June 20, 2018/0 Comments/in News /by StevenAdmin

Our 3rd incarnation of our website is now live and looking sharp!

Recent Posts

  • FileMaker Data API and Portal Filters
  • fm-csv2json
  • FileMaker Web Direct Clock
  • fm-mime-types
  • fm-xml2json

Recent Comments

  • Tkakeshi Nakano on fm-xml2json
  • Takeshi Nakano on fm-xml2json
  • menno on fm-xml2json
  • tuxun on fm-mime-types
  • Neil Nguyen on fm-xml2json

Archives

  • May 2019
  • April 2019
  • March 2019
  • June 2018

Categories

  • FileMaker
  • fmapi
  • News

Bespoke Business Apps

We provide Bespoke Business Apps tailored to how you run your business.

We utilise our highly specialised Certified FileMaker Developers to create elegant and efficient Business Apps that transform your business processes and fulfil your custom business needs.

Based around the Central Belt of Scotland, UK.

Head Office

Units 18/19
Waverley Street Industrial Estate
Bathgate
United Kingdom
EH48 4HY

Email Us!

Latest Work

  • Shift.online – Booking ScreenApril 3, 2020 - 12:04 am
  • MCR PathwaysMCR PathwaysMCR Pathways – Local Authority UpgradeMarch 6, 2018 - 5:55 pm
  • MCR PathwaysMCR PathwaysMCR PathwaysJuly 27, 2016 - 3:05 pm
  • Callum Innes StudioCallum Innes StudioCallum Innes StudioJune 27, 2016 - 3:03 pm
  • BusinessMan ERPComputech IT ServicesBusinessMan ERPApril 1, 2013 - 4:26 pm

Sitemap

  • Bespoke Business Apps
  • Development Process
  • Free Consultation
  • Latest News
  • Our Story
  • Our Work
  • Privacy Policy
©2018 WhiteSpace Systems. All rights reserved. - powered by Enfold WordPress Theme
  • Facebook
  • Skype
  • Mail
  • Linkedin
Scroll to top

This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.

OKLearn more

Cookie and Privacy Settings

How we use cookies

We may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.

Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.

Essential Website Cookies

These cookies are strictly necessary to provide you with services available through our website and to use some of its features.

Because these cookies are strictly necessary to deliver the website, you cannot refuse them without impacting how our site functions. You can block or delete them by changing your browser settings and force blocking all cookies on this website.

Other external services

We also use different external services like Google Webfonts, Google Maps and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.

Google Webfont Settings:

Google Map Settings:

Vimeo and Youtube video embeds:

Privacy Policy

You can read about our cookies and privacy settings in detail on our Privacy Policy Page.

Privacy Policy