Jump to content
Server Maintenance This Week. ×

FMEasySync - Force the syncing to sync only the newly added records from the last sync


This topic is 3104 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello to all,

First of all, thanks to Tim for his brilliant work. 

I wonder if we can force the syncing script to sync only those records which are added to the mobile file, after the last successful sync. Those records which are synced once, should not be pushed to the hosted file, even if they are removed from the hosted file already. Perhaps,  we can add a on option to put them back in the syncing list, in case needed to be synced again.  Any thoughts?

My aim is too keep the data on mobile file for 7 days after they are pushed to the hosted file, and thereafter, they supposed to be removed automatically to prevent having a big mobile file on Ipad.

Warmest regards,

Siroos.

Edited by Lee Smith
removed extra returns
Link to comment
Share on other sites

Hello,

Actually I know how to use ES_EXCLUDE field to remove a record from payload list. My question is that in which script should I add a "set field" script step to set the ES_EXCLUDE to "1" after a successful sync. 

By this, I mean if the sync process is successful, then there should be a loop through the fields and set the ES_EXCLUDE field to 1 so they will not sync again. the user can clear the EX_EXCLUDE field to put the record back to the payload list. 

Thanks,

Link to comment
Share on other sites

I found the solution by myself, you need to add below script steps to the “Sync with server” script. They should be added right after the message box shows the sync is complete.

Set Error Capture [ On ]

Perform Find [ Specified Find Requests: Omit Records ; Criteria: Your Table::ES_Exclude : “=1” ] [ Restore ]

If [ Get(FoundCount)>0 ]

Set Variable [ $i; Value:1 ]

Loop

Set Field [ Your Table::ES_Exclude ; 1 ]

Set Variable [ $i; Value:"i+1" ]

Exit Loop If [ $i>Get(FoundCount) ]

End Loop

End If

Show All Records

 

So what it does is that it will find those records with empty “ES_EXCLUDE” fields, the loop trough them and set them to “1”. Remember you need the “$i” variation to force the loop to exit after it went through all found records set.

Hope this make sense.

Regards,

 

 

Edited by Lee Smith
Removed extra returns to make it more readable.
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

This looks very interesting... Please can you modify your script step to exclude more tables?  Assume I want to apply this script with respect to customers, staff and products tables, how do I go about it... 

Sorry to bother you.. Not really good when it comes to scripting especially those that involves looping 

Link to comment
Share on other sites

 Please can you modify your script step to exclude more tables? 

Actually this script steps will exclude records from a synchronize table. Those records which are synced once, will not sync in the next syncing run. To avoid a table from syncing, you simply do not add the "Easysynd" fields to it. to make one way syncing like push only or pull only, Please see below link:

http://timdietrich.me/fmeasysync/docs-easysync.php

I am not quiet sure if I answered your question, if not please let me know.

Link to comment
Share on other sites

My apologies for the error in my question.. Actually I was meant to ask excluding records from several tables..  Like can you modify your script to something like Yourtable1::ES_Exclude ... Yourtable2::ES_Exclude... Yourtable3::ES_Exclude 

I am looking at excluding records from Customer, Client, Invoice tables 

Link to comment
Share on other sites

Save the script steps I have above as a new script and call it "SyncEXCLUDE" for example, then in  the “Sync with server” script add below, right after the message box shows the sync is complete. 

Go to Layout[Customer::Customer]

Perform Script[SyncEXCLUDE]

Go to Layout[Client::Client]

Perform Script[SyncEXCLUDE]

Go to Layout[Invoice::Invoice]

Perform Script[SyncEXCLUDE]

Go to Layout[original layout]

 

 This means you have to run these steps for each and every tables you are syncing. What the script is doing is it go through the tables, find those records which are not excluded from syncing, set the ES_Exclude field to 1 so they will not get synced next time. so you have to do the same procedure for all the tables.

Edited by siroos12
  • Like 1
Link to comment
Share on other sites

Hi Siroos,

I've been following this thread, and I would like to know why you feel it's necessary to mark the records using the ES_EXCLUDE flag? Records will not be included in the payload if they have not been edited since the last sync.

Barbara

Link to comment
Share on other sites

Hi Barbara,

 

Thank you for your message, Actually based on my client policy, each record has to be synced once, even if they are edited after syncing, but they should not be removed from the Ipad. That is why i have to exclude them after they are synced once.

 

Regards.

Link to comment
Share on other sites

This topic is 3104 days old. Please don't post here. Open a new topic instead.

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.