Validating Row Count Between Two Form Grids
Introduction
This section illustrates the process of comparing the row counts of two form grids within the same form. This comparison is valuable when ensuring that the row count in one grid (Form Grid 1) meets specific criteria with the row count in another grid (Form Grid 2).
How does it work?
To compare the row counts of two form grids within a single form, follow these steps:
- Import necessary classes and define the
validate
method. - Use the
FormUtil.findElement
method to get Form Grid 1 using its ID from the same form. - Extract rows from both grids and compare their counts.
- Ensure that Form Grid 1 has a row count that is the same as or higher than that of Form Grid 2.
- The method returns
true
if the condition is met; otherwise, it returnsfalse
.
The following Java code is deployed in a multi-row bean shell validator in Form Grid 2 (ID: formgrid2
). Below is an example code snippet demonstrating how to implement the comparison of form grid row counts: