Duh!
Couldn't see it for looking!
Thank you very much.
Announcement
Collapse
No announcement yet.
X
-
Just write
Code:criteria = new AdvancedCriteria( OperatorId.OR, new Criterion[] { criteriaOne, criteriaTwo } );
Leave a comment:
-
AdvancedCriteria / CombineCriteria question
Hello,
I am using smartGwt 2.5 (according to the jar) which I downloaded from the nightlies on 8th Feb.
I have been trying to combine two advancedCriteria but seem to be having problems.
I have two criteria, criteriaOne and criteriaTwo as follows...
Code:AdvancedCriteria criteriaOne = new AdvancedCriteria(OperatorId.OR, new Criterion[] { new Criterion("status", OperatorId.EQUALS, 2), new Criterion("status", OperatorId.EQUALS, 3)}); criteriaOne.addCriteria(new AdvancedCriteria("incInVat", OperatorId.EQUALS, 1)); AdvancedCriteria criteriaTwo = new AdvancedCriteria(OperatorId.OR, new Criterion[] { new Criterion("status", OperatorId.EQUALS, 2), new Criterion("status", OperatorId.EQUALS, 3)}); criteriaTwo.addCriteria("paidVat", OperatorId.NOT_EQUAL, 1);
I have tried to do this
Code:criteria = new AdvancedCriteria(criteriaOne); criteria.addCriteria(criteriaTwo); criteria.setOperator(OperatorId.OR);
I have tried this
Code:criteria = new AdvancedCriteria(DataSource.combineCriteria(criteriaOne, criteriaTwo).getJsObj());
I have also tried this
Code:criteria = (AdvancedCriteria)DataSource.combineCriteria(criteriaOne, criteriaTwo, CriteriaCombineOperator.OR, TextMatchStyle.SUBSTRING);
Could you please tell me how I can combine the two criterias with an OR operator? I appreciate that I could do it manually but I have more complex criterias to combine and would like to use the methods provided.
Many Thanks
JeniTags: None
Leave a comment: