Tuesday, March 4, 2014

Deleting all Grid rows

A very simple yet very useful code to give users the option to delete all grid rows on a page at once. I've implemented such a requirement by placing a "Delete all" button above a grid to give PeopleSoft users the option to delete all rows at once instead of clicking the "-" grid button. If the gird has, lets say, 20 rows, then a user will have to click the "-" delete grid button 20 times to delete all rows, compared to one click on the "Delete all" button.
Place the code below behind a field change event.
   &RECCNT = ActiveRowCount(Record.record_name_behind_grid);
   For &I = &RECCNT To 1 Step - 1
      DeleteRow(Record.record_name_behind_grid, &I)
   End-For;
It is important to point out that users will still have to save the page for the deletion to take place at the database level.

No comments:

Post a Comment