NetTalk Central

Author Topic: DeletedTimeStamp for Web Server application  (Read 3358 times)

DonnEdwards

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Insights and Rants
    • Email
DeletedTimeStamp for Web Server application
« on: May 10, 2021, 02:58:45 AM »
I have a database that I plan to use for two apps:
1. Web Server app for office administration using a web browser
2. Web Server API app to provide a link to other systems and an Android (disconnected) app to be written by a third party developer.

When I generated the web server app using the NetTalk Wizard I didn't click the "Server API's to sync Disconnected Data" option, only the "Web Server App - for access via a browser" option.

So now I notice that the Web Server app (correctly) deletes a record when I ask it to, but I need it to mark it as deleted by setting the DeletedTimeStamp record to Now(), because it is sharing this data with the API server, and the other systems will need to know when a record is deleted.

a) What is the correct way to modify the Delete Record routine to set the DeletedTimeStamp record instead of actually deleting the record? Is there a flag I can set or do I need to modify some code?

b) Am I correct in assuming that I will need to filter the browse forms by adding DeletedTimeStamp = 0, or is there an option I can set to do this globally?

c) When I use the NetTalk Wizard to create the "Web Server API App" should I also select "Server API's to sync Disconnected Data" so the API App will "know" about the DeletedTimeStamp field and do a soft delete?

All advice will be gratefully received.

FWIW, all my tables have the three TimeStamp records required for Disconnected data.
If you're happy with your security, then so are the bad guys

Jane

  • Sr. Member
  • ****
  • Posts: 372
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: DeletedTimeStamp for Web Server application
« Reply #1 on: May 10, 2021, 11:29:07 AM »
Donn,

I'm not doing disconnected apps at this point.  But like you, with an eye toward future-proofing I'm using the timestamp fields.

I override the ABC File Manager methods so the timestamps get set and the record is not physically deleted.  And yes, I manually filter out the "deleted" records in browses.  (Some browses have a "show deleted records" checkbox... just because I can...)

Cheers,

Jane


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: DeletedTimeStamp for Web Server application
« Reply #2 on: May 10, 2021, 10:36:37 PM »
There's a bunch of support built-in to NetTalk for this.

a) There's obviously support in the NetSync desktop-side procedure, which I won't discuss here.

b) there is a global extension you can add to the Server program - called "Set Time Stamp Fields". This generates the FileManager code to set the timestamp, servertimestamp and deletedtimestamp fields for you. This coveres the overrides Jane added (presumably) manually to the ABC File Manager methods.

c) Most filters (Browses, Drop lists, Map Data, Gallery, Carousel, Autocomplete, CCS-From-Tables, Calendar, Browses, ServiceMethods [1]) make a call to p_web.MaybeRemoveDeletedRecords method [2]. So deleted records are automatically excluded from all these lists.

d) Currently there is *no* filter added to reports - that still needs to be done manually.


[1] Service Method procedures contain a local variable, Loc:RemoveDeletedRecords, which is set to true by default. It is automatically set to false for Sync methods, when doing a sync. You can override this variable if you want to include deleted records.

[2] MaybeRemoveDeletedRecords tests the p_web.RemoveDeletedRecords property. If this is true records are suppressed. If false, then not. The default value is true. On threads where you do want the deleted records to appear (eg for undelete functionality) set this to false.


So, in short, if you just add the global extension I think you'll find that there's nothing else to do.

Cheers
Bruce


DonnEdwards

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Insights and Rants
    • Email
Re: DeletedTimeStamp for Web Server application
« Reply #3 on: May 11, 2021, 01:40:53 AM »
The Global extension works perfectly. See attached image. Thanks @Bruce

I tested it by adding and removing a record, and then looking in the TPS file. Sure enough the record is still there, but marked as deleted. It no longer shows up in the browse form.

If you're happy with your security, then so are the bad guys