NetTalk Central

Author Topic: Disconnected Desktop issues  (Read 2437 times)

MyBrainIsFull

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Disconnected Desktop issues
« on: February 27, 2016, 09:41:28 PM »
Using the Capesoft example, with a server running
and two desktops running (D1 & D2) in separate folders - ie they hold individual data when disconnected.

Issue 1
if you hit insert on D1 the form opens, lets say it shows Invoice=1 ,  your user looks at the form for a while (makes coffee for 1 min - sync occurs)  and decides not to do this and hits cancel.
Look at D2 (refresh invoices) it now has an empty record with Invoice=1
Is there a way to stop this happening ?

Issue 2
In the example - the update invoice form has no range limit (by table) set, but even when you fix this

The Invoice has a child browse of Line Items
If you enter any, these items dont get updated.  

Is this a "to-do"   - or is the sync of children the programers responsibility, and if so, is it correct procedure to call the Sync LineItems ?

Using NT 906 / J Files 119 / String 243 / X 277

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Disconnected Desktop issues
« Reply #1 on: February 28, 2016, 09:58:15 PM »
Issue 1 is much worse than you think!
simulate this with any ABC program, running "2 instances on the LAN" (or 2 instances on the same machine.)

a) go to any auto-incrementing form
b) go to the other instance, to the browse. The "half entered" row is visible.

This is a side-effect of using auto-incrementing with ABC. (or Legacy). The templates always add a record at the start of the form (even if it is not necessary.) [aside: NetWebForms are smarter, they decide if it is necessary or not, and also give you overrides so you can control the behavior.]

The "sync" is doing exactly what you want it to do - synchronizing the database. The problem is thus not with the sync, but with the underlying ABC approach.

Fortunately the problem is much reduced when you are not using auto-Inc just to identify rows. In the desktop example auto-inc is only done in 1 place, the Invoice number. Notice also that the auto-inc key on that table is NOT unique. (Since multiple different desktops could add invoices with the same number.)   If I did have a need to auto-number like this I would be tempted to re-set the number as the record arrives into the server.

Assuming your browses suppress "deleted records" one way to possibly avoid the problem you are seeing with a half-completed record though is perhaps to set the DeletedTimeStamp field to "now" when the form is opened, then clear that when the form is closed. I haven't tested this approach though, so try it out first.
INV:DeletedTimeStamp = glo:SyncDesktop.GetElapsedTimeUTC()

Cheers
Bruce






Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Disconnected Desktop issues
« Reply #2 on: February 28, 2016, 10:13:03 PM »
Hi Kevin,

Issue 2:
-----------
>> In the example - the update invoice form has no range limit (by table) set,

and indeed no "priming" of the LIN:InvoiceGUID field on the UpdateLineItems form.

>> The Invoice has a child browse of Line Items. If you enter any, these items dont get updated.  

yeah, they do. But you have to make the ABC program "correct" first. I've tweaked the example for the next release so the ABC part is "more correct".

cheers
Bruce

update: - Also if you are using Guid's then you really want to use RecentLookups to do the lookups. The built-in lookup system is a little primitive (displaying the "code" field to the user, not the description field). I've used the built-in for the updated example, but it looks a little dof.
« Last Edit: February 28, 2016, 10:15:43 PM by Bruce »