Page 1 of 1
Syncing related tables
Posted:
Tue Jan 28, 2014 1:27 pm
by jmundok
I have several tables defined as dependent or related in the GoZync Hosted file. If I run a ZyncIt script for a single parent table, should GoZync automatically sync the parent and it's children or just the parent?
Thanks!
Jason
Re: Syncing related tables
Posted:
Tue Jan 28, 2014 2:43 pm
by jeffalmquist
Hi Jason. If you've set up related synching in GZH, then when you sync the parent table, all children will also be sycned, but only for parent records that have been modified. So if only child records are changed (or added, or deleted), you need to trigger the mod timestamp to update in the parent record so GoZync will sync it. We advise that you do this using an OnRecordCommit script trigger that just sets the gz_ModTimeStamp field in the parent record to "1" (which will force that field to auto-enter the current timestamp). More about all of that here:
http://www.seedcode.com/pmwiki/pmwiki.p ... RecordMods
Re: Syncing related tables
Posted:
Tue Jan 28, 2014 5:18 pm
by jmundok
Great. Thanks for the info Jeff. I'll look into the link tomorrow.
Re: Syncing related tables
Posted:
Tue Feb 04, 2014 8:31 am
by jmundok
Hi Jeff,
I was able to implement your suggestion and that is working well. I'm setting the parent to update whenever I change the children or grandchildren records. One additional issue has to do with the grandchildren records. When I do a Push for a particular record ID, it's only pushing the children tables:
Visits -> Evaluations -> Eval Questions
Eval Questions is set in the configuration to be a child of Evaluations but those records don't seem to get pushed when syncing the grandparent Visit. Is that expected?
Thanks!
Jason
Re: Syncing related tables
Posted:
Tue Feb 04, 2014 11:16 am
by jeffalmquist
Hi Jason. Related syncing in GoZync only goes one "level" deep. It doesn't support synching of "grandchildren" (the engine would have to be exponentially more complex). You'll have to choose one of those relationships for related synching and sync the third table independently. Maybe set up Eval Questions as a child of Evaluations, and set up Visits to sync independently. HTH -Jeff
Re: Syncing related tables
Posted:
Tue Feb 04, 2014 12:04 pm
by jmundok
Thanks, Jeff. I set it up so that the Eval Questions table gets the Visits ID as well, and then set Eval Questions as a child of Visits in the config. That will work for now. Thanks for the reply!
Re: Syncing related tables
Posted:
Tue Feb 04, 2014 12:09 pm
by John Sindelar
Jason- that works. Just remember that the "parent" side of a relationship being synced needs to use the primary key of the table. GoZync won't consider relationships where the parent / left-hand side uses a foreign key.
HTH
- John