NetTalk Central

Author Topic: Netsync question 2  (Read 6036 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Netsync question 2
« on: August 19, 2019, 02:16:09 PM »
Can I insert/update records in the server database directly without the sync process?
I mean I have a Central office which inserts/update records on its database, with a NTsyncWebServer listening other offices sync clients?
Im trying this setup but the server never sends the records for insert to the clients, it allways uses a filter like xxx:TimeStamp>everythigafter and not sending the sts=0 records
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Netsync question 2
« Reply #1 on: August 19, 2019, 07:08:37 PM »
Hi Alberto,

so I think what you are saying is that at the Server location;
a) you have a webserver acting as the Sync Server and _also_
b) a normal desktop program reading and writing the database directly.
BUT
c) data edited by the desktop program does not get sync'd to the clients?

If that's he case then the desktop program needs to set the timestamp AND servertimestamp for records that it updates. (See global extension.) Because it's editing records in the "server" version of the database it also needs to update the ServerTimeStamp.

This desktop program also does not need to talk to the sync server.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Netsync question 2
« Reply #2 on: August 20, 2019, 06:22:12 AM »
Yes, thats the case...
Then I will create a global variable to set to true the update ServerTimeStamp if its the central office and to false if not.
The central desktop does not talk to the sync server.

Im seeing that when the records are synced from client to server the timestamp and the servertimestamp are a litle different and then this records are allways sent to the server even if they does not change.
« Last Edit: August 20, 2019, 08:56:43 AM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Netsync question 2
« Reply #3 on: August 21, 2019, 12:05:45 AM »
I'm a little confused;

>> I'm seeing that when the records are synced from client to server
>> the timestamp and the servertimestamp are a litle different

I presume you mean "after the records are saved on the server, then when inspecting the server side data then the timestamp and the servertimestamp are a little different " ?
Is that correct?

On the server side, are you setting the time stamp fields yourself? Or are you letting the global NetTalk template do it via the ABC File Manager objects? Are you adding the records to the database manually?

Cheers
Bruce

« Last Edit: August 21, 2019, 02:10:46 AM by Bruce »

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Netsync question 2
« Reply #4 on: August 21, 2019, 07:44:13 AM »
>>>I presume you mean "after the records are saved on the server, then when inspecting the server side data then the timestamp and the servertimestamp are a little different " ?
Is that correct?

Yes, after, please re-read my "Netsync question 3", see pic 4
Ive done nothing but add records and sync.

>>>On the server side, are you setting the time stamp fields yourself?
No
>>>Or are you letting the global NetTalk template do it via the ABC File Manager objects?
Yes
>>> Are you adding the records to the database manually?
No
Yes the server side is seting the sts using NT template

Please see "Netsync question 3", pic 1 add 2 recs on central, pic 2 add 2 recs from Pilar, pic3 you can see the modifies duplicated each time y click on sync, see pic 4 you can see the diff between ts and sts

Problem seams to be in the server...
Adding this:
      Operadores{prop:sql}='update operadores set STS=TS where operador='&OPE:operador
in the server UpdateRecord:Operadores  routine after the p_web.UpdateFile(Operadores)
and
in the server InsertRecord:Operadores  routine after the p_web.AddFile(Operadores)
solves the problem

May be its doing...
st = GetTime...()
sts= GetTime...() (a little late)
Just a thought...



« Last Edit: August 21, 2019, 12:25:10 PM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Netsync question 2
« Reply #5 on: August 21, 2019, 07:54:16 PM »
>> May be its doing...
>> ts = GetTime...()
>> sts= GetTime...() (a little late)

yes, I agree, that's what it feels like (hence my questions).
But the generated code looks like this;

  If (true) then Use:TimeStamp = glo:SyncDesktop.GetElapsedTimeUTC().
  IF (true) then Use:ServerTimeStamp = Use:TimeStamp.

To avoid this exact problem. you'll see this if you look in your _bc0.clw module.
Which is why I'm wondering if you've overriden this code somewhere.

You mentioned overriding the INSERT to cope with autonumbering, and replacing it with ADD, but that means you also need to manually set the timestamps. Are you also setting it like the code above, and not like;

>> ts = GetTime...()
>> sts= GetTime...()

??

Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Netsync question 2
« Reply #6 on: August 22, 2019, 06:09:51 AM »
Problem 1: ts<>sts

in_bc0.clw in all insert and update procs:

  If (true) then OPE:TimeStamp = glo:SyncDesktop.GetElapsedTimeUTC().
  IF (true) then OPE:ServerTimeStamp = OPE:TimeStamp.

this is weird...
see pic 1, STS is a little less than TS

Im doing nothing with ts or sts but correcting them with the update... sts=ts... in the server
Ive serach all my .clw and found nothing that touchs TS or STS
Any other thing I can serch for?

Problem 2: ADD instead of INSERT

Im having the same problem in the client side and when you said you are using ADD...
mhhh something is wrong... then I test to manually add records and...
Nothing to do with it, Im using a server side autonumber and because its done by an SP called by the driver, even when I ADD, the autonumber is generated.

Is there any way of "disable" the DriverString while syncing so the ADD does not generates it?



« Last Edit: August 22, 2019, 09:08:13 AM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Netsync question 2
« Reply #7 on: August 22, 2019, 08:23:04 PM »
Hi Alberto,

Sorry mate - I'm completely lost. Between this thread, and the other thread, I've no idea of what your problem is, or even which side of the equation it's at...

I think maybe your manual code is breaking it, but I'm not even sure what manual code you have, or where it is...

cheers
Bruce