Skip to Content
0
Former Member
Mar 24, 2009 at 09:27 PM

unable to retrieve records with search criteria

37 Views

Hi All,

I am trying to retrieve records based on search criteria as below, but not able to retrieve records.

I created a search Search s=new Search(repSchema.getTableId("Customers"));

Search s=new Search(repSchema.getTableId("Customers"));

SearchGroup sg = new SearchGroup();

FieldSearchDimension fsdCustFinValidated = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Financially_Validated")));

BooleanSearchConstraint bSearchComm_Validated = new BooleanSearchConstraint(false);

s.addSearchItem(fsdCustFinValidated, bSearchComm_Validated);

s.setComparisonOperator(Search.AND_OPERATOR);

FieldSearchDimension fsdMaintableType = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Company_Type")));

TextSearchConstraint tscCustType = new TextSearchConstraint("CUSTOMER", TextSearchConstraint.EQUALS);

s.addSearchItem(fsdMaintableType, tscCustType);

s.setComparisonOperator(Search.AND_OPERATOR);

Calendar calCreate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));

calCreate.add(Calendar.DATE,-6);

System.out.println("customerCreditEscalation: calCreate:" + calCreate.getTime());

FieldSearchDimension fsdMaintableDate = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Financially_Validated_Trigger")));

SearchConstraint srchConstCreateGE = new DateTimeSearchConstraint(calCreate,DateTimeSearchConstraint.LESS_THAN_OR_EQUAL_TO);

sg.addSearchItem(fsdMaintableDate,srchConstCreateGE) ;

sg.setComparisonOperator(Search.AND_OPERATOR);

Calendar calCreate1 = Calendar.getInstance(TimeZone.getTimeZone("GMT"));

calCreate1.add(Calendar.DATE,-7);

SearchConstraint srchConstFinVldTrgrDate = new DateTimeSearchConstraint(calCreate1,DateTimeSearchConstraint.GREATER_THAN_OR_EQUAL_TO);

sg.addSearchItem(fsdMaintableDate, srchConstFinVldTrgrDate);

s.addSearchItem(sg);

Basically I am trying to search using A=a and B=b and (C=c and D=d) where (C=c and D=d) is the search group.

Please let me know if I am doing anything wrong.

Thanks

-Sai