private int remainingCategory(DynamicGridRow rowCons) { if (rowCons == null || rowCons.getRows() == null) return 0; ProcedureCategoryCollection allProcCat = LookupHelper.getProcedureCategory(domain.getLookupService()); if (allProcCat == null || allProcCat.size() == 0) return 0; for (int i=0 ; i<rowCons.getRows().size(); i++) { DynamicGridColumn mainCol = form.dyngrdMain().getColumns().getByIdentifier(MAIN_COLUMN); DynamicGridCell dynamicGridCell = rowCons.getRows().get(i).getCells().get(mainCol); if (dynamicGridCell.getValue() instanceof ProcedureCategory) { allProcCat.remove((ProcedureCategory) dynamicGridCell.getValue()); } } return allProcCat.size(); }