Delete Grid Blank Rows Entered by Users When Saving

No votes yet

Sometimes users click the "+" on the grid to enter data but end up
clicking it more than once and getting some extra empty rows in the
gird. The peopleCode to get rid of any extra empty grid rows when the
user saves is as follows:


Local Rowset &pnlbuf;
Local Rowset &data;
Local number &Rows;
Local string &Ethnic, &Descr, &Primary;
/*If there is a blank row entered, delete the row*/
&pnlbuf = GetLevel0();
&data = &pnlbuf(1).GetRowset(Scroll.DIVERS_ETHNIC);
&Rows = &data.ActiveRowCount;
For &i = &Rows To 1 Step - 1
&Ethnic = &data.GetRow(&i).GetRecord(Record.DIVERS_ETHNIC).GetField(Field.ETHNIC_GRP_CD).Value;
&Descr = &data.GetRow(&i).GetRecord(Record.ETHNIC_GRP_TBL).GetField(Field.DESCR50).Value;
&Primary = &data.GetRow(&i).GetRecord(Record.DIVERS_ETHNIC).GetField(Field.PRIMARY_INDICATOR).Value;
If None(&Ethnic) And
None(&Descr) And
None(&Primary) Then
&data.DeleteRow(&i);
End-If;
End-For;

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.
5 + 13 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.