Flush Unwanted Grid Rows Using PeopleCode

Your rating: None Average: 3.8 (5 votes)

In one of my previous posts; I showed you how to populate a grid
using a record or view and a "where" clause. But, what if you want to
narrow the data on the grid depending on what the customer wants to see.

Example:
Lets say you have a grid that shows PTO balance for your employees. The
page the customer is using have a check box that if checked will narrow
the grid data to only show "Negative" PTO balances. This is how you go
about doing that:

If GRID_RPT_WK.NEGATIVE_BALAN = "Y" Then
&numberOfRows = &RS.ActiveRowCount;
/*loop through the grid data on row at a time*/
For &I = 1 To &numberOfRows

&ptoBalance = FetchValue(Scroll.MGR_ELB_RPT, &I, TL_PTO_WRK.TAFW_PTO);
/*if PTO balance is positive then go ahead and delete the row from the
grid and the component buffer. Note that FlushRow will not delete the
row from the database */

If &ptoBalance > 0 Then
&RS.FlushRow(&I);
End-If;
End-For;
End-If;

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
The question below is to prevent automated spam submissions.
1 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.