This primarily a client side general question about AdvancedCriteria. We have come across the need to find if an AdvancedCriteria contains a particular field/key criterion and what is the value of the criterion. Take this simple case:
Some other method gets passed this criteria c, and it wants to find check if the field named "ERC_RuleCheckName" or "DRC_RuleCheckName" exists, and what is it's value.
We have a support utility that recursively goes down an AdvancedCriteria and searches for the existences of Criterion that contains the passed field name. One version of the utility that returns a true or false, if the field exists, and another that returns the value or null. The utility is recursive as there may be many AdvancedCriteria in a wrapper Criteria.
Is there a method that we have missed in the documentation that does this more efficiently, or can replace our recursive utility that we are missing?
Finally is there an equivalent for the server side code?
I don't believe it is important to qualify this question with a particular version of SmartGWT, but we are on a late July 2018 build of 6.1.
Code:
AdvancedCriteria c = new AdvancedCriteria(OperatorId.AND, new Criterion[] { new Criterion((isERC) ? "ERC_RuleCheckName":"DRC_RuleCheckName", OperatorId.IN_SET, item.getValues()), new Criterion ( "canExpand", OperatorId.CONTAINS, "true"), new Criterion ( "Total_Num", OperatorId.GREATER_THAN, 0) });
We have a support utility that recursively goes down an AdvancedCriteria and searches for the existences of Criterion that contains the passed field name. One version of the utility that returns a true or false, if the field exists, and another that returns the value or null. The utility is recursive as there may be many AdvancedCriteria in a wrapper Criteria.
Is there a method that we have missed in the documentation that does this more efficiently, or can replace our recursive utility that we are missing?
Finally is there an equivalent for the server side code?
I don't believe it is important to qualify this question with a particular version of SmartGWT, but we are on a late July 2018 build of 6.1.
Comment