NetTalk Central

Author Topic: NetTalk disconnected desktop app  (Read 2918 times)

hkalmbach

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • Email
NetTalk disconnected desktop app
« on: May 15, 2018, 06:47:36 AM »
Hello,

I have the following task. I want to build an offline client programm for a windows device, there as first step a disconnected desktop app.
This client should be used in the following way:
- People walk around in a factory with the device, on the device they have their tasks (orders), work with them and later this should be synchronised with the server
- On the offline device they should have not the complete server data base, but a selection of data corresponding to their person. Therefore at the beginning of each day the client data base should be empty in regard of the orders, some other tables stay filled on the client, as basic data like machines, persons. The emptying can be done after synchronizing the last day.
- For the actual day there should be the possibilty to tell the sync procedure, that only orders from the server are fetched which have been assigned to the actual person on the server. Other records of the order table should not be fetched.
- This selection or filter should be set in the client app while connected to the network and as soon a filter is set and the next sync is started the related records should be fetched from the server.

Is it possible to do this with the sync procedure or do I have to write an own procedure which copies the relevant records from the server data base to the client database?

Thanks for every hint

Regards,
Heinz

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: NetTalk disconnected desktop app
« Reply #1 on: May 17, 2018, 12:04:48 AM »
Hi Heinz,

This all looks like fairly standard Disconnected Desktop type functionality.
So I recommend you build it as a simple disconnected database program, and then add your requirements one at a time after that.

Most of what you are describing is just done with Filters in the Sync procedure on the server side.

cheers
Bruce

hkalmbach

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • Email
Re: NetTalk disconnected desktop app
« Reply #2 on: May 22, 2018, 02:13:40 AM »
Hi Bruce,

thanks for your answer.
I think I found most of what I need:
- In the ServerSync procedure on client side the possibility to filter records on client side.
- In the syncFile procedure of the server the possibility to filter the records on Server side, they are filtered with FileView{Prop:Filter} in the routine BuildResultFields
(This I need, because in one case on the server there are > 100.000 records, the client only should get ~20 of these records, starting with an empty table, and the filter on client side here is very much to slow, it takes than half an hour even if the server and client are on the same computer.)

But some questions are left:
- in my case I have a main table with serveral sub tables. The main table is this where the client should get the mentioned 20 records. All the sub records of these 20 main records should be synced to the client, but only they, not the complete sub tables (these may contain > 100.000 records each).
How can I filter them on server side to get a fast sync? If I filter them on client side all 100.000 records have to be sent and checked, and only lets say 100 are ok and are inserted in the client table.
- The main table in addition to the GUID field has an autonumbered order number field. If a client creates a new  order and this is synced to the server it may be, that the order number of the client already is used on the server. Therefore I create a new order number in PrimtFields:File. This works so far. But if after the first sync, where the record gets to the server with a new order number, the record is changed on the client, the server record is not updated again. I saw that the problem starts in SyncRecord:File because the record on client side has no ServerTimeStamp and therefore is look at as an incoming insert.
Should the record be resynced from the server to get back the ServerTimeStamp?
The next step is, that if I get an error in InsertRecord:File (Duplicate) the next check is ReallyTheSame:File, but this does not result in a positive result because the order number is different. How can I manage this case?
- If I have the described situation that after the first sync there is an order on the server with different order number, but same GUID as on the client, and then on the server the record is changed, should this change be synced to the client with the next snyc? This does not happen.

Thanks a lot for hellp.

Cheers
Heinz

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11181
    • View Profile
Re: NetTalk disconnected desktop app
« Reply #3 on: May 23, 2018, 12:13:37 AM »
Hi Heinz,

>> This I need, because in one case on the server there are > 100.000 records, the client only should get ~20 of these records, starting with an empty table, and the filter on client side here is very much to slow, it takes than half an hour even if the
server and client are on the same computer.

Of course filtering on the server side is much, much better than filtering on the client side.

<< - in my case I have a main table with serveral sub tables. The main table is this where the client should get the mentioned 20 records. All the sub records of these 20 main records should be synced to the client, but only they, not the complete sub tables (these may contain > 100.000 records each).

<< How can I filter them on server side to get a fast sync? If I filter them on client side all 100.000 records have to be sent and checked, and only lets say 100 are ok and are inserted in the client table.

It's not hard to do a filter on the server side so that only applicable child records are sent.
For example, say I wanted to Sync Invoices, and only Invoices belonging to the customer. Then obviously I also need to filter Line Items so that only the line items for the passed invoices are sent.

So I can use a VIEW, join the line items to the Invoice, do a filter on the Invoice fields, and hence end up with just the line items for the invoices that are ok. This is a pretty basic filter....

>> - The main table in addition to the GUID field has an autonumbered order number field. If a client creates a new  order and this is synced to the server it may be, that the order number of the client already is used on the server.

Auto-numbering is done "server side". So the client does not set the order number at all. You can use a placeholder there if you like, but the client will not know the order number until only _after_ the order has been sync'd.

On the server side the auto-number field is populated (and the new value is sent back to the client.)

>> Therefore I create a new order number in PrimtFields:File.

On the server or the client? You should do this on the server side.

>> This works so far. But if after the first sync, where the record gets to the server with a new order number,

the record should get to the server with no order number.

>> the record is changed on the client, the server record is not updated again. I saw that the problem starts in SyncRecord:File because the record on client side has no ServerTimeStamp and therefore is look at as an incoming insert.
Should the record be resynced from the server to get back the ServerTimeStamp?

When a record is changed on the server, it will get a new TimeStamp and a new ServertimeStamp.
Then this record will automatically be sent back to the client, because the new timestamp will be after the "EverythingAfter" setting. (which is part of the return filter.)

>> The next step is, that if I get an error in InsertRecord:File (Duplicate) the next check is ReallyTheSame:File, but this does not result in a positive result because the order number is different. How can I manage this case?

I suspect if you do it right, passing up order number 0, this issue goes away.

>> - If I have the described situation that after the first sync there is an order on the server with different order number, but same GUID as on the client, and then on the server the record is changed, should this change be synced to the client with the next snyc? This does not happen.

then there's a problem in your returns sync.

Cheers
Bruce