Page 1 of 1

Child table data only sync when parent table data changed

PostPosted: Thu Jun 27, 2013 5:00 pm
by Ming.Jiang
Thank you Jeff for your support in your email for this issue, and I will put our discussion here so everybody who has the same issue can learn and everybody can make their comments too.


The issue is that the Child table data does not sync unless some data in the parent table is changed.

We don't want the child tables to be synced separately due to transactional reasons. All the tabs are ticked in the integration layout, and I cannot see any error message in the Zync logs.

Re: Child table data only sync when parent table data change

PostPosted: Thu Jun 27, 2013 5:02 pm
by Ming.Jiang
The following is the helpful reply from Jeff:

GoZync looks at the modification time of the parent record (or primary TO) to see if the entity as a whole has been modified. You can use a script trigger to update the modification timestamp field in the parent record. Here's some more info about that:

http://www.seedcode.com/pmwiki/pmwiki.p ... RecordMods

Re: Child table data only sync when parent table data change

PostPosted: Thu Jun 27, 2013 5:41 pm
by Ming.Jiang
Jeff, I think I understood the cause and solution. But I still have a couple of issues:

1. The editing layout of my Primary TO and its child tables is my Sync Layout.
I think it is normal to have the Invoice Items in a Portal of the same layout of the Invoice.

2. I tried to add a script to set the field "gz_ModTimeStamp" in my primary TO (invoices, in this example) to 1, and make it to be trigger by the "OnObjectSave" event trigger of the child table portal. But for some reason (I guess this is a FileMaker issue), it will not be triggered if any data is saved in this child table portal.

The only way I can make it work is to make the script to be triggered by the "OnObjectSave" event trigger of each field of the child table portal. But is this the best practice to do this kind of thing, I may have many fields in many levels of parent-child tables. Is there a better way of doing this?

Thanks.

Re: Child table data only sync when parent table data change

PostPosted: Fri Jun 28, 2013 5:45 am
by jeffalmquist
The script trigger to set the "gz_ModTimeStamp" in your primary TO needs to be at the layout-level. Choose the "On Record Commit" option for that.

We advise that you make a dedicated sync layout that is not part of your user-interface. That way you can control the synching rules independent of any UI considerations. You'll have to do this because the designated Zync layout can't have any script triggers on it.

This is all described here:
http://www.seedcode.com/pmwiki/pmwiki.p ... RecordMods

Re: Child table data only sync when parent table data change

PostPosted: Sun Jun 30, 2013 10:53 pm
by Ming.Jiang
Thank you very much Jeff for your help, and this is working now.