Hide Add Button if a Row Exists on the Grid

Your rating: None Average: 2.7 (3 votes)

I have been working a lot with Grids lately and this is an example on how to hide an "Add" button under the grid so that users can only enter one row.

The comments between the code should explain what I'm trying to do here. But please, don't hesitate to ask if need be!

Local Rowset &RSEthnic;

&RSEthnic = GetLevel0()(1).GetRowset(Scroll.DIVERS_ETHNIC);
/* Check the rows in the grid after the user deletes a row. If a row exists then hide the
add button (user can only enter one Ethnic Group) */
If &RSEthnic.ActiveRowCount = 1 And
All(&RSEthnic.GetRow(1).DIVERS_ETHNIC.ETHNIC_GRP_CD.Value) Then

/* if no data left in the grid after the user performs a delete, then go ahead and show the
add button so user can add a new Ethnic group*/

If &RSEthnic.ActiveRowCount = 1 And
None(&RSEthnic.GetRow(1).DIVERS_ETHNIC.ETHNIC_GRP_CD.Value) Then

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!


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

Post new comment

The question below is to prevent automated spam submissions.
1 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.