Delete on a Maintenance Form


Author
Message
Ger Cannoll
Ger Cannoll
Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
Group: StrataFrame Users
Posts: 430, Visits: 507
When I delete a row from within a Maintanance Form, I notice it deletes from the Database immediaitely, unlike when I edit rows, I can Undo before I save.

Is there a way of 'Holding' the deletes until I click on Save, so that any Deletes/ Edits are all done at the same time , an I am also given an option to 'Undo', for deletes
Replies
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Gerard.

Have a look at the following:

  • DeleteCurrentRow() - There are three overloads to this method. Depending on the parameters passed, this method will behave differently.
      • DeleteCurrentRow() - When this overload is called, the record being deleted is immediately removed from the server and the internal data table is updated.

      • DeleteCurrentRow(OnlyMarkAsDeleted) - When OnlyMarkAsDeleted is given a value of True, the current row is deleted within the internal data table only and a Save() must be executed before the changes are reflected back to the server. This is recommended when deleting a large number of records.

      • DeleteCurrentRow(CheckSecurity, OnlyMarkAsDeleted) - When a value of True is passed to the CheckSecurity parameter, a security check will be forced by raising the CheckSecurity event on the business object, allowing the developer to place any Security on Delete code. The OnlyMarkAsDeleted parameter behaves identically to the DeleteCurrentRow(OnlyMarkAsDeleted) overload described above.

    Note: All deletion methods return the number of records affected by the deletion. If a zero is returned, no records were deleted from the server.


    Ger Cannoll
    Ger Cannoll
    Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
    Group: StrataFrame Users
    Posts: 430, Visits: 507
    Hi Ivan. Tnaks for replying.

    How do I access the DeleteCurrentRow method with the various over-rides from a SF Maintanace Form ?
    Edhy Rijo
    E
    StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
    Group: StrataFrame Users
    Posts: 2.4K, Visits: 23K
    Hi Gerard,

    Gerard O Carroll (7/20/2011)
    How do I access the DeleteCurrentRow method with the various over-rides from a SF Maintanace Form ?


    You can handle the BO.BeforeDelete event and manipulate the delete routine as you wish and then set the e.Cancel to True as shown in the code below:

        Private Sub BizVendor1_BeforeDelete(e As MicroFour.StrataFrame.Business.BeforeDeleteEventArgsHandles BizVendor1.BeforeDelete
             e.BusinessObject.DeleteCurrentRow(True)
             e.Cancel = True
         End Sub


    Edhy Rijo

    Ger Cannoll
    Ger Cannoll
    Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
    Group: StrataFrame Users
    Posts: 430, Visits: 507
    Hi Edhy.

    I put following code into the BeforeDeleteEvent:

    e.BusinessObject.DeleteCurrentRow(true, true);
    e.Cancel = true;


    It goes round in an infinite loop with following question: Are you sure you wish to delete the current record ? where I can select a yes or No button. My table only has about 10 records .

    This is on a Standard maintenance form and I dont have any other code in there.


    Edhy Rijo
    E
    StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
    Group: StrataFrame Users
    Posts: 2.4K, Visits: 23K
    Hi Gerard,

    Why are you using the 2 overloads?  are you checking security for deleting the record? if not, just use one parameter of True to mark the record as deleted without saving it to the database.

    Edhy Rijo

    Ger Cannoll
    Ger Cannoll
    Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)Advanced StrataFrame User (866 reputation)
    Group: StrataFrame Users
    Posts: 430, Visits: 507
    Hi Edhy.

    I was using the two overloads to 'Future Proof' tha app (I dont have Security switched on right now but do intend to )

    I chnged just to have one overload and same thing... just keeps looping asking If I am sure I want to delete
    GO

    Merge Selected

    Merge into selected topic...



    Merge into merge target...



    Merge into a specific topic ID...




    Threaded View
    Threaded View
    Ger Cannoll - 14 Years Ago
    Ivan George Borges - 14 Years Ago
    Ger Cannoll - 14 Years Ago
    Edhy Rijo - 14 Years Ago
                         Hi Edhy. I put following code into the BeforeDeleteEvent:...
    Ger Cannoll - 14 Years Ago
                             Hi Gerard, Why are you using the 2 overloads? are you checking...
    Edhy Rijo - 14 Years Ago
                                 Hi Edhy. I was using the two overloads to 'Future Proof' tha app (I...
    Ger Cannoll - 14 Years Ago
    Ivan George Borges - 14 Years Ago
    Edhy Rijo - 14 Years Ago
    Ivan George Borges - 14 Years Ago
    Edhy Rijo - 14 Years Ago
                             But Edhy, the original Delete is being Canceled just fine. What is...
    Ivan George Borges - 14 Years Ago
    Ger Cannoll - 14 Years Ago
                             Good to know, glad we moved on. I am out of the office right now and...
    Ivan George Borges - 14 Years Ago
                                 Hi Ivan. I set the switch and inserted my own code , which works...
    Ger Cannoll - 14 Years Ago
                                     It was coming twice because you areissuing delete twice.The message...
    Ivan George Borges - 14 Years Ago

    Similar Topics

    Reading This Topic

    Login

    Explore
    Messages
    Mentions
    Search