Delete Grid Blank Rows Entered by Users When Saving

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;

转载于:https://www.cnblogs.com/GoDevil/archive/2008/08/18/1270389.html

你可能感兴趣的:(Delete Grid Blank Rows Entered by Users When Saving)