NetTalk Central

Author Topic: NetSync question  (Read 5930 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
NetSync question
« 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
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetSync question
« Reply #1 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


Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NetSync question
« Reply #2 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.
« Last Edit: August 20, 2019, 11:48:19 AM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetSync question
« Reply #3 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

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NetSync question
« Reply #4 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!
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetSync question
« Reply #5 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


Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NetSync question
« Reply #6 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
-----------
Regards
Alberto