NetTalk Central

Author Topic: Flagging Record Instead of Deleting Record  (Read 3091 times)

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Flagging Record Instead of Deleting Record
« on: September 12, 2012, 08:46:16 AM »
Application is a Static page with dynamic content - NT 6.42

Because this is a static page with dynamic content app, Bruce earlier said that to delete, the delete button had to be on the Form and not the browse.  OK, that works for deleting, and that is what I have been doing.

So now, I have a delete button on a form (tps file).  But, instead of deleting the record, I want to update it with a flag to indicate that the record is "deleted" and the calling browse will filter out such flagged records.  This is so that, if necessary, the "deleted" record can be undeleted by the supervisor.  I know - moron customer.

Now, to implement the "delete flag", Bruce suggested the following:

1. In the ValidateDelete embed, set ans = net:ChangeRecord and set the record's delete field flag.

This works fine - the record is not deleted but the delete "flag" field is set in the record.  So far, so good.

Now, two issue remain for the complete implementation.

1. When you click the delete button on the form, there is no message asking if the user really wants to delete the record, and I would like to popup a message asking to confirm that the delete is desired, and if the answer is yes, then proceed to the delete flag code, otherwise just ignore the fact the delete was pressed.

2. The actual delete flag code needs to be a bit more than just setting that one flag in that one record.  There are child records involved, so I need to also call up the relevant child records and flag them also (so they appear to have been deleted).  I would like to do this by calling a common source procedure and have it do the flagging of all the appropriate child records and then return back.  Where and how would I call that source procedure? 

Can you help with how to deal with these two issues.  I've implemented the delete flag method in the desktop version of the app, and it works great, but these two points on the NetTalk app have me stumped.

Mike Springer

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Flagging Record Instead of Deleting Record
« Reply #1 on: September 12, 2012, 05:22:00 PM »
"1. When you click the delete button on the form, there is no message asking if the user really wants to delete the record, and I would like to popup a message asking to confirm that the delete is desired, and if the answer is yes, then proceed to the delete flag code, otherwise just ignore the fact the delete was pressed."

> I've never had much luck with yes/no popups. I used them a lot in Windows but the web architecture doesn't lend itself as easily to to implement them. Not to say you can't use them, they just need to be used in strategic places. I've used a checkbox on the form instead which the user needs to tick before they click the delete/save button otherwise they just get a popup to say if they really really want to delete the record click the checkbox first.

"The actual delete flag code needs to be a bit more than just setting that one flag in that one record.  There are child records involved, so I need to also call up the relevant child records and flag them also (so they appear to have been deleted).  I would like to do this by calling a common source procedure and have it do the flagging of all the appropriate child records and then return back.  Where and how would I call that source procedure? "

> I would stick that in the validateupdate embed after the code from point1. 

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Flagging Record Instead of Deleting Record
« Reply #2 on: September 14, 2012, 06:29:30 AM »
Thanks Kevin,
I have the more involved delete flagging working now. 

Regarding your idea of having a checkbox on the form to act as the user's "validation" that they do want to delete the record, I have not been able to generate a popup message from the form.  Can you point me in the right direction here?

I'm at the ValidateDelete embed, where I change the ans value to Net:ChangeRecord.  Obviously, I would check the local variable checkbox to see if I need to flag the record or not, but how do I popup a message at this point?

Thanks for your help.
Mike Springer

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Flagging Record Instead of Deleting Record
« Reply #3 on: September 14, 2012, 01:07:08 PM »
either change your form into change mode at the start of the form in a pre-delete embed or move your logic to the validateall embed. You need to do an exit after do sendalert.