Jump to content

All records syncing despite setting ES_exclude...


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

Recommended Posts

Firstly, I'm new here so 'hi' everyone and thanks Tim for your EasySync solution... it looks like it will save me hours of head scratching!


I appeared to have successfully integrated EasySync into my current project – I was delighted when everything looked like it functioned as expected and I was able to do a remote first-time sync and pull everything from the Server into my (blank) Client file, however I think I need a bit of help... 


The solution I'm working on has ~1500 records in the parent 'contact' table, with an equivalent number of child records ('data' table) plus there is also a 'photos' table which will potentially contain multiple related records although it is currently empty. The 1500 records are split into 3 areas – north, east and west – and when finally deployed I will want these records to sync by user so that for example, the north user initially pulls and subsequently syncs only those records marked as 'north'.


Having read the documentation I figured the simplest way to do this was to changed the ES_Exclude fields to a calculation which I've set as follows (both in the hosted database and the remote client version):


Case ( PatternCount ( globals::areaFilter ; area ) ; 0 ; 1 )


When reviewing the data, this calculation works perfectly – when the user is either north, east or west the ES_Exclude field is correctly set to 0 or 1 as appropriate (plus I can log in as an 'office' user which doesn't exclude any records).


However having transferred the database file to my iPhone and logged in as 'east' for testing, then wiped and reset EasySync (using the Sync Utilities script) to ensure that there are no records on the device, when I then performed a first-time sync which I expected only to pull the 'east' records from the host, it doesn't seem to have excluded any records as it is pulling down everything... 


I'm hoping someone can point me in the right direction here as I'm not sure what I've missed... any help and advice would be much appreciated

Link to comment
Share on other sites



The problem be a result of the global field ("globals::areaFilter") that you're using to filter the records.


EasySync makes heavy use to the Perform Script on Server script step. When scripts are called with PSoS, the Draco session that is initiated on the server does not inherit the values of the global fields that were set by the client.


You might want to try passing the "areaFilter" value via the $$additional_push_info and $$additional_pull_info variables, which you can set in the "EasySync Settings" script. This gives you the ability to send additional custom info during the push and pull phases.


Good luck!


-- Tim

Link to comment
Share on other sites

Sincere thanks for the reply Tim – I'll give that a go later and hopefully it will solve my filtering issue 


Can you just clarify that I do in fact need to set the ES_Exclude value both in the client file and the server file..?

Link to comment
Share on other sites

With the way that you are syncing, I think you should only need to set the ES_Exclude value on the server.


On the client side, the thought was that it would be used to delay the pushing of records to the server. For example, a work order that wasn't quite ready to be "submitted" yet.


-- Tim

Link to comment
Share on other sites

I didn't have any luck passing the global::areaFilter value to the host via the $$additional_pull_info variable and then using that variable in the ES_Exclude calculation definition. I suspect I may be missing something...


However, I have now been able to successfully filter the initial pull sync by using Get(AccountName) in the ES_Exclude calculation definition... going to do further testing to ensure it's working as expected but it looks like I've got a functioning solution.

Link to comment
Share on other sites

  • 3 weeks later...
  • Newbies

I also was trying to exclude records using dynamic variable and found a bug.


  1. I was able to pass variables to the server via [mobile] EasySync Settings >> $$additional_pull_info
    • Set Field ==> Some_Global_B to $$additional_pull_info
  2. Retrieve variables from [server] Prepare Payload for Client >>  $additional_settings

  3. I was able to set the [server] ES_Exclude >>
    • Succesful --> If ( Studio_Name = "studio17"; 0; 1)
      //this solution was not helpful, since it was fixed and could validate it worked.
    • Fail --> If ( Studio_Name  = Some_Global_B ; 0 ; 1)  
    • Fail --> If ( Studio_Name  = $additional_settings ; 0 ; 1)  
    • Fail --> GetAsNumber ( If ( ES_Surveys::Studio_Name = $additional_settings ; 0; 1) )
    • Successful --> Evaluate ( $expression)
      Set Variable ==> $expression to "If ( Studio_Name  = Some_Global_B ; 0 ; 1)"
Needless to say it was difficult to understand why 3b or 3c did not work.  
I hope this benefits others.






Link to comment
Share on other sites

This topic is 2814 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.