Back to
Latest changes:

This is an old revision of the document!

How to run through query conditions

Sometimes you need to run through all conditions in your query to perform some operation for each condition or to find a particular one. Here is a code snippet which demonstrates this operation:

private void RunThroughConditions(Predicate predicate) {
    foreach (Condition cond in predicate.Conditions) {
        if (cond is SimpleCondition) {
            SimpleCondition scond = (SimpleCondition)cond;
            if (scond.BaseExpr is EntityAttrExpr) {
                EntityAttrExpr attrExpr = (EntityAttrExpr)scond.BaseExpr;
                //here is the attribute of this condition
                EntityAttr attr = attrExpr.Attribute;
                //here is condition operator
                Operator op = scond.Operator;
                //now we run through all expressions in this condition (except the first one) and check their values
                for (int i = 1; i < scond.Expressions.Count; i++) {
                    Expression expr = scond.Expressions[i];
                    string value = expr.Value;
                    string text = expr.Text;
        else if (cond is Predicate) {
.  .  .  .  .  .  .  .  .  .  .
//to start the process just call this function for the Root predicate in your Query


, 2013/07/03 16:36

How do we add a condition dynamically to the condition panel?
to have a condition in the condition panel when the page loads.

, 2013/07/03 17:15
You need to add it into Query object and it will appear in QueryPanel automatically.
We have another article about this:
Enter your comment: