Deletes not being 'pulled' down to the device

Help, Tips, and Tricks for deploying GoZync: our "sync" engine for FileMaker Go.
Posts: 142
Joined: Thu Nov 01, 2012 2:36 pm
PostPosted: Fri Feb 08, 2013 6:30 am
Hi all,
I've noticed that when we delete contacts from our file, they are not deleted from the device after a sync. I have the following setup:

x3 Tables
People
Sites
JoinPeopleSites

Contacts are added to People and assigned to a Site via a mutual record in the Join table. When somebody leaves a customers employ, we go to the People layout and delete the Join table record (which is in a portal) and then we delete the contact record from the People table.

When we check the Site layout, that person does not exist which is the result we wanted. However, when we do the sync, the People, Site and Join tables all have the original record.

I thought this might need a status flag that I've read about previously but I believe that this is only for situations when a delete is done at the device and that needs to be replicated on the hosted file.

Am I correct, what else should I be looking at to resolve this issue?

Thanks
Brian.
Last edited by brian.curran on Fri Feb 08, 2013 8:51 am, edited 1 time in total.
SeedCode Staff
SeedCode Staff
Posts: 2760
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Fri Feb 08, 2013 8:48 am
Hi Brian,

The delete flag is about passing deletes from the mobile file up to server, so that's not the solution here.

My guess would be that you're not pulling (syncing) the contacts table, and that's why contacts aren't being deleted. Try syncing the contacts table by hand using the Zync It button on the dashboard of GoZyncMobile.

If you were syncing just sites or just the join table, you wouldn't see the People deletes happen.

If that doesn't get it for you, I'd be happy to look at your files. It could be that you have duplicate contact IDs, or that the logged in user in your mobile file doesn't have the rights to delete records. Send an email to support at seedcode.com for instr on sending us files if you don't remember from last time.

- John
John Sindelar
SeedCode
Posts: 142
Joined: Thu Nov 01, 2012 2:36 pm
PostPosted: Sat Feb 09, 2013 12:09 pm
Hi John,
The 'People' table containing our contacts data is definitely being synced but only some of the contacts that I delete in the hosted file are being deleted in the mobile file. I can't work out why some are deleted and some are not deleted...

I tried the 'Zync Now' button in gzMobile but the stubborn records still exist. I'm logged in with full access rights and doubt that we have duplicate ID's as we moved to UUID's.

Can you think of anything else I should look at before sending my files across?

Thanks
Brian.
SeedCode Staff
SeedCode Staff
Posts: 2760
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Sat Feb 09, 2013 6:37 pm
Maybe... the delete mechanism is carried out when GoZyncHosted sends the mobile device a list of the IDs in the found set. This is at the beginning of the Package you can see in GoZyncMobile's Zync Log after a sync. You could export this ID list and search it for the IDs of the records you've deleted on the hosted side. If those IDs are in the package then the local records won't be deleted and those IDs are in your hosted found set somewhere.

If the IDs aren't in the package, then something is preventing GoZyncMobile from deleting these records. You might run a sync with script debugger on and a breakpoint AFTER the comment "do the find" in the script "Delete Records Not In The IDs List (IDs)" GoZync will find all the records in the ID List and then delete the opposite found set.
John Sindelar
SeedCode
Posts: 142
Joined: Thu Nov 01, 2012 2:36 pm
PostPosted: Sun Feb 10, 2013 1:13 pm
Hi John,
The ID isn't listed in the package but the record still exists so I tried your breakpoint suggestion:

Start numbers are:
Hosted file = 481 People
Mobile file = 484 People

At the breakpoint in the script, "Perform Find []" the found set contains 481 records
At the next script line, "If [gz_ThereWasNotAnError]" the number of records is 484/484
At the "Show Omitted Only" step, the number of records is 0/484 which I'm guessing why nothing is being deleted.

I don't understand the script lines so maybe you could share some light on whether the above numbers are correct. Meanwhile, I'm going to export the People table from both files to compare them to see if the only difference is the three extra records in the hosted file...

Thanks
Brian.
SeedCode Staff
SeedCode Staff
Posts: 2760
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Sun Feb 10, 2013 1:29 pm
=) So if the IDs aren't in the list, but ALL records are bring found in the mobile file, it is because you have text based IDs that start similarly. Thus, while you're IDs now are UUIDs, you probably have some old IDs like "1" or "102". IDs like this, when we do a find, will find (and this not delete) any records whose IDs begin with 1 or 102.

So you can delete the records manually, or change your IDs so they're all actually UUIDs.

Hope that helps,

John
John Sindelar
SeedCode
Posts: 142
Joined: Thu Nov 01, 2012 2:36 pm
PostPosted: Sun Feb 10, 2013 1:42 pm
Thanks John, that makes sense as the first 450 records are old ID's from when we used auto-incrementing serial numbers at the beginning.

I'm a little unsure of a safe/trusted method to change the ID's as I don't want to screw up any relationships if I do this incorrectly. Do you know of any URLs detailing how this can be done safely?

Alternatively, I could add "==" to the find but then this would need repeating for all other tables, scripts etc. would imagine...
SeedCode Staff
SeedCode Staff
Posts: 2760
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Sun Feb 10, 2013 4:42 pm
Actually you'd only have to add the "==" on the find requests built in the script "Delete Records Not In The IDs List (IDs)" =)
John Sindelar
SeedCode
Posts: 142
Joined: Thu Nov 01, 2012 2:36 pm
PostPosted: Mon Feb 11, 2013 2:12 am
Would I change the line in red text below somehow? I can't work out where I need to put the & "==" & before the ID...

#------------------------------------------------------------------------------
#remove the records from this TO #------------------------------------------------------------------------------
Set Variable [ $CheckZyncDB; Value:False // this gets set to true later if required ] Enter Find Mode [ ]
#
Set Variable [ $FieldName; Value:/*
Returns the fully qualified name of the PrimaryID for a given TO
The graph must be constructed correctly, ie attachments to GoZync must be ok */
Let(
[
TOName = $TO;
info = RelationInfo ( Get( FileName) ; "GoZync" ); p=Position(info;"Table:" &TOName&"¶";1;1); p2 = Position ( info ; " = " ; p ; 1 );
info = Middle(info; p; p2-p);
c = ValueCount(info)
];
GetValue(info; c)
)]
#
#create requests for each ID Set Variable [ $i; Value:1 ] Loop
Set Variable [ $id; Value:GetValue($IDs; $i ) ] Exit Loop If [ IsEmpty ( $id ) ]
#
Set Field By Name [ $FieldName; $id ]
New Record/Request
#
Set Variable [ $i; Value:$i + 1 ]
End Loop
#
#
#delete the last empty request
Delete Record/Request
[ No dialog ]
#
#do the find
Perform Find [ ]
SeedCode Staff
SeedCode Staff
Posts: 2760
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Mon Feb 11, 2013 7:27 am
Thanks for the screen shot, but that's not it: make the change shown in the blue line below.

Enjoy!

s3.png
s3.png (28.08 KiB) Viewed 6144 times
John Sindelar
SeedCode
Posts: 142
Joined: Thu Nov 01, 2012 2:36 pm
PostPosted: Mon Feb 11, 2013 11:32 am
That works great, many thanks John...

Return to GoZync

Who is online

Users browsing this forum: No registered users and 2 guests

cron
(855) SEEDCODE
support@seedcode.com
Follow us: