Syncing Your Data

If you went through the Fast Start process, your app will be offline by default. You now need to decide how your data is going to be handled. Is your app online or offline? Does it sync data with a FileMaker server, and when?

Adding Data Options

If you still have your Fast Start project open from the previous lesson, just click on "Data Options" in the sidebar.

1) Select Yes if you want to sync data with a FileMaker server. Select no if you have a completely offline app you never want to share data with from a FileMaker server.

2) Select Yes if you have data in your solution that you want included in the first build of your app. You can still select yes to this even if you don't want to sync data with a server, but you will need a server set up to do the initial extraction.

If you select no to both of these options, you will skip straight to the test and deploy screen. I've checked yes, and clicked next.

Are you ready to sync?

On the next screen, LCFM is detecting whether or not your app is ready to sync. To sync successfully, you need to have three items set - a primary key field, a modification time stamp, and a creation timestamp. You don't necessarily have to have these on every table in your solution - only on the ones you want to sync. In the screenshot above, I have three tables I want to sync, and one, Globals, that I don't. If you don't have at least one table with three checkmarks, your app will not sync. To set up your app for syncing please follow the steps in this lesson. When you are sure your app is ready, click yes, continue.

You will see the screen above, and then something like the screen below, as LCFM opens FileMaker and gets to work.

At this point you need to step away from the computer, don't touch anything or interact with any dialogs until it has finished, and you see this:

1) Checking for changes. Whenever your app connects to the server, looks for changes and applies those changes, it causes a delay to actions in the interface. This may be anything from unnoticeable to very annoying to your end user, depending on your app and your settings. If you expect your data to change a lot, but your user can wait a few minutes to get it, set this interval high. If it doesn't change much so a sync doesn't take long to perform, but your user needs the info as soon as it happens, set it low. I've set for every 30 seconds, which is fine for what I'm doing.

2) Checking for deleted records takes a long time. I've set these checks to the maximum length of time here as its not crucial to my solution.

3) Set the retry attempts. If you lose a connection, how many times do you want to keep trying before you give up? I've set it to 3, which seems like a reasonable number.

Syncing Checklist

We're nearly ready to build our syncing app. Final steps:

1) Open your original FileMaker solution, in FileMaker. Set the fmrest permissions on it. Upload it to your FileMaker server.

2) In FileMaker, open the Gateway (interface) solution that LCFM has just created for you, by clicking on the small blue arrow (circled). You can also find this in your project folder, which should be in Documents, named whatever you called your project initially. It will be called <yoursolutionname>-interface.fmp12.

3) Set the username and password for the interface file, and set the fmrest permissions as described in this lesson. Upload it to FileMaker Server.

4) Switch on the DataAPI on FileMaker Server

5) Enter your FileMaker Server address in the box. This can be found on the Dashboard of your server installation. Note that if you are using a remote server, you should enter the address without the http or https part. So if your server is on http://my-filemaker-server.com/ you would enter my-filemaker-server.com.

6) If your server is secured by a full SSL certificate, choose Yes. If you are using a self signed certificate or no certificate, choose No.

Click next.

Build your app

LCFM will go through a building dialog, and if all is well, you should end on the screen above. Click on Test and Deploy, to return to the deployment screen.

You can test and deploy the app.

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.