Jump to content

How to *not* delete records on hub when syncing?


Recommended Posts

  • Newbies

How can i prevent mirrorsync from deleting records from the hub when i deleted them on FilemakerGo. I tried to search the forum, but i didn´t find an answer. Do you have any idea? I was already thinking about a second configuration, but i cant come up with an solution. Thank you in advance for your inputs

Link to post
Share on other sites

I'll answer your second question first. Yes, it is very easy in MirrorSync to only sync records that match certain find criteria. This is done using regular FileMaker finds, like this example to only include Job records for the current user where the status is Active.

If[ Get( LayoutName ) = "Sync_Jobs" ]
Enter Find Mode
Set Field[ Job::Status; "Active" ]
Set Field[ Job::Username: Get( AccountName ) ]
Constrain Found Set
End If

See the MirrorSync 6 script and read the comments; it will tell you were to insert these steps.

Records not matching this criteria are *deleted* on the *spoke*. So for instance, if job 123 with status 'active' exists on the hub and spoke for user Jesse, and an administrator went onto the hosted file and changed the status for job 123 to 'complete', then on Jesse's next sync, job 123 would be deleted from his iPad, because it no longer matches the filtering criteria in the script steps shown above.

Now for your first question - in a bidirectional sync, deleting records from the spoke will also delete them from the hub. That's because MirrorSync is designed, wherever possible, to behave the same as if you were connected directly as a guest to FileMaker Server. If you don't want this behavior, you can change the sync to one-way from the spoke to the hub. This is common for 'data collector' solutions, where inspectors go out and gather data, sync it to the server, then delete it from their device after their sync is finished.

If you want the sync to be bidirectional, AND you don't want deletions from the spoke to be deleted on the hub, then modify the 'willDelete' section of the MirrorSync 6 script. Add these lines to remove items from the found set, ensuring that they won't be deleted:

Show All Records
Show Omitted Records

I hope that helps to answer your question!

--Jesse Barnum

Link to post
Share on other sites
  • Newbies

I have now set up 2 configurations 1 for "download" and 1 for "upload". Additionally i modified the 'willDelete' script with your suggestion, and this perfectly solved my problem. Thank you very much again Jesse.

  • Like 1
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
×
×
  • Create New...

Important Information

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