LiveCode for FM Guide Ben Lui

Syncing Your Data

Updated on

In this example I have chosen to extract data (2) as well as sync (1). Note: before you start this lesson, make sure you have closed FileMaker if it is open. LCFM Native is going to open and drive FileMaker during the process, it needs to be closed before you start. Also make sure before you start that you have set your keyboard to a compatible Qwerty keyboard, and you have added LCFM Native to your Accessibility pane in system settings.

Adding Data Options

Click 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. Note: if all your tables are set up to sync, you won't see the screen above. You'll go straight to the next stage.

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

In the top right corner of your screen you will see the "LCFM Native at work" dialog. Don't touch the screen until this disappears. The only exception to this is if you see a system dialog which says something like "LCFM Native wants to access your Documents folder... Allow?" In this case you do need to click "allow". Otherwise, don't enter any passwords, don't respond to any dialogs, just wait for LCFM Native to do its thing.

Note: if your solution doesn't have a lot of data in it, this shouldn't take more than a few minutes. If it does, then this step can take quite a long time. Get a cup of tea, walk the dog, watch the cricket... but don't touch anything until it has finished.

When LCFM Native has finished scraping your FM solution and creating the gateway file, you will land on this screen:

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.

In the next lesson we'll get your solution files uploaded to the server, ready to sync with your app.

Previous Article To Extract or Not to Extract Data
Next Article Syncing Checklist Step 1. Set the Fmrest Permission and Upload your Solution