There are different ways to filter the data/rows in a VO.
1. Using Where clause:
You can use setWhereCluse() method from VO to set filter constraint before calling executeQuery() method to filter data based on the input condition. This means we are appending the where clause while querying the data to the DB. This will take string as in input.
Ex: ViewObjectImpl empVO = am.getEmployeeVO();
//filtering data using setWhereClause on employee_id
empVO.setWhereClause("employee_id=" + empId);
empVO.executeQuery();
Note: Here employee_id is the column name from the db table.
You can have multiple constraints in where clause just like in sql.
emp.setWhereClause("employee_id=" + empId + "employee_name like " + empName);
2. Using getFilteredRows(): getFilteredRows() is from VO, this method is used to filter rows based on one column only and returns Row[]. getFilteredRows() returns the Row[] by filtering the rows from VO cache based on the column attribute passed.
Ex: ViewObjectImpl empVO = am.getEmployeeVO();
//filtering data using setWhereClause on employee_id
empVO.executeQuery();
Row[] rows = empV.getFilteredRows("EmployeeId", empId);
Note: EmployeeId is the attribute name from VO.
3. Using Row Qualifier: Using RowQualifier you can filter the data based on multiple columns from VO cache.
Ex: ViewObjectImpl empVO = am.getEmployeeVO();
//Create RowQualifier from VO
RowQualifier rowQualifier = new RowQualifier(empVO);
//set where clause to row qualifier
rowQualifier.setWhereClause("EmployeeId="+empId+" AND EmployeeName="+empName);
//get filtered rows using row qualifier
Row[] filteredRows = emp.getFilteredRows(rowQualifier);
Note: EmployeeId & EmployeeName are the attribute names from VO.