How to Search Record From Dynamic Data List in Liferay 6.2 Hello Guy's In this blogs we have described how to search record from dynamic data list in liferay version in version 6.2. We have explain all process step by step you can easily search record from the daynamic data list after reading this blogs. Some time many of us faces difficultly in searching record from dynamic data list in Liferay 6.2, so for your help below I am mentioning how you can do this-
Here I have created two methods for search record from dynamic data list in liferay 6.2. ddlRecordnew.get(i).getField("firstName").getValue() Here :
"ddlRecordnew" is instance of List<DDLRecord> and "firstName" is field name of data list in dynamic data list. So now : ddlRecordnew.get(i).getField("FieldName").getValue()
Following method print the matched record from searchString to database. 1.
public void SearchDdlRecord(String searchString){
2. 3. 4.
List<DDLRecord> ddlRecordnew = null; try {
5. ddlRecordnew = DDLRecordLocalServiceUtil.getDDLRecords(-1, Integer.MAX_VALUE); 6. 7. 8.
if (ddlRecordnew != null) {
9.
StringTokenizer strPermit = null;
10.
String ptype = null;
11. 12.
for (int i = 0; i < ddlRecordnew.size(); i++) {
13. if (isRecordMatchingSearchCriteria(searchString, ddlRecordnew.get(i)) ) { 14. strPermit = new StringTokenizer(String.valueOf(ddlRecordnew.get(i).getField("permitType ").getValue()),"[]\""); 15.
while (strPermit.hasMoreTokens()) {
16.
ptype = strPermit.nextToken().trim();
17.
}
18. System.out.println(ddlRecordnew.get(i).getRecordId()+" "+ddlRecordnew.get(i).getField("firstName").getValue()+" "+ddlRecordnew.get(i).getField("lastName").getValue()); 19. 20. 21.
}
22.
}
23.
}
24.
}
25.
catch (Exception e)
26.
{
27.
e.printStackTrace();
28. 29.
}
30.
}
Following method match the searchString to database record and return boolean . 1. public boolean isRecordMatchingSearchCriteria(String searchString, 2. 3.
DDLRecord ddlRecord) { try {
4. 5. < 0
if (searchString == null || searchString.length()
6. 7.
|| searchString.equals("")) return true;
8. â&#x20AC;Ś Read Full Blogs : How to search record from dynamic data
list in Liferay 6.2 You can check more informative blogs and tutorials at iphone and android development blogs section and can also browse the android and iOS developer forum for posting and viewing latest questions on iphone development.