NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on August 19, 2019, 01:58:38 PM

Title: NetSync question
Post by: Alberto on August 19, 2019, 01:58:38 PM
In netsync.clw
NetWebSyncClient.PageReceived PROCEDURE
You receive the records FROM the server to be ins/upd localy
Where are this ins/upd routines?
Thanks
Title: Re: NetSync question
Post by: Bruce on August 19, 2019, 07:05:19 PM
line 324;

 result = rcvdjson.load(self.ViewTable,self.Thispage,self.TableLabel)

jFiles does all the hard work here.

cheers
Bruce

Title: Re: NetSync question
Post by: Alberto on August 20, 2019, 06:07:37 AM
Ok, I imagine that but did not found it in the docs.

Got a problem, this is an old system that has some autonumbers and I need to maintain it between databases, so...

I will need you to PLEASE :
In the client sync: add a check to the template to make jFiles to use ADD() instead of .insert()
And too in the server sync method, in the InsertRecord: routine.

Im doing it by code but is horrible what I need to do.
Title: Re: NetSync question
Post by: Bruce on August 21, 2019, 12:09:02 AM
Hi Alberto,

>> Got a problem, this is an old system that has some autonumbers and I need to maintain it between databases, so...

tell me more about how you expect this to work?
Let's say we have an Invoice table, with an AutoNumber. And I add an invoice at site A and site B at the same time.
What numbers do you expect to use at the time the invoices are added?

Then the data is sync'd with the server. What numbers do you expect to be in the data now?

You might want to read this;
https://www.capesoft.com/docs/NetTalk11/NetTalkApps.Htm#DataSyncAutoNumbering

cheers
Bruce
Title: Re: NetSync question
Post by: Alberto on August 21, 2019, 07:51:53 AM
This system uses an SP to autonumber the records.
In Central office the records are numbered from 0, in Pilar office from 100000000, so when synced theres no problem with them, they are always unique.
When I try to sync them with NT, the server and the client, when receives a new record try to Insert it, then the autonumber SP is used and replace the original autonumber by a new one.
If the last in Central is 100 and the Pilar record has the 10000001 value, when synced it becames 101 in the centra db.
If Server and client would use ADD instead of .INSERT then the problem is solved.
Hope Im clear enought!
Title: Re: NetSync question
Post by: Bruce on August 21, 2019, 07:56:42 PM
Hang on -
You started this thread asking about netsync.clw, which is the _client_ side -
but now you say the problem is the auto-inc on the _server_ side?

The client side uses JSON, and this does an ADD, not an INSERT, so if your solution is to replace INSERT with ADD
then it seems you would have done that on the _server_ side ?
Or am I confused?

cheers
Bruce

Title: Re: NetSync question
Post by: Alberto on August 22, 2019, 05:46:29 AM
Ahhhh ok, thats why if I add
update... sts=ts ... (see Netsync question 2)
in the server insert and update the problem is solved, the client does an ADD, cool