Hi,
While Filtering a Data From iggid using remote side filtering we came across the Following Issue.
An exception of type 'Infragistics.Web.Mvc.ParseException' occurred in Infragistics.Web.Mvc.dll but was not handled in user code
Additional information: Expression expected.
The data we used to filter are as follows,
Copy of SPA_BTS_Test_20171003_V1.xlsx imported within Project.code-codecio : Failure - 5 error(s)
while we tried to paste the above string in filter its shows no exception error , but for testing we tried to paste the same above error simultaneously two times without any delay
we face that above Exception.
The source we used are as follows,
public IQueryable ApplyFilterExpr(NameValueCollection queryString, IQueryable customers)
{
List exprs = GetFilterExpressions(queryString);
StringBuilder builder = new StringBuilder();
int count = 0;
for (int i = 0; i < exprs.Count; i++)
if (count != 0 && count <= exprs="" count="" -="" 1="" b="">
builder.Append(exprs[i].Logic.ToLower() == "AND".ToLower() ? " AND " : " OR ");
}
count++;
string condition = exprs[i].Condition;
string expr = exprs[i].Expr;
string colKey = exprs[i].Key;
//string isNumeric=false;
var dt = DateTime.Now;
switch (condition.ToLower())
case "startswith":
builder.Append(colKey + ".ToLower().StartsWith(\"" + expr.ToLower() + "\")");
break;
case "contains":
builder.Append(colKey + ".ToLower().Contains(\"" + expr.ToLower() + "\")");
case "endswith":
builder.Append(colKey + ".ToLower().EndsWith(\"" + expr.ToLower() + "\")");
case "equals":
if (colKey == "ShipName")
//col type is string
builder.Append(colKey + ".ToLower() == \"" + expr.ToLower() + "\"");
else
//col type is number
builder.Append(colKey + " == " + expr);
case "doesnotequal":
builder.Append(colKey + ".ToLower() != \"" + expr.ToLower() + "\"");
builder.Append(colKey + " != " + expr);
case "doesnotcontain":
builder.Append("! " + colKey + ".ToLower().Contains(\"" + expr.ToLower() + "\")");
case "lessthan":
builder.Append(colKey + " < " + expr);
case "greaterthan":
builder.Append(colKey + " > " + expr);
case "lessthanorequalto":
builder.Append(colKey + " <= " + expr);
case "greaterthanorequalto":
builder.Append(colKey + " >= " + expr);
case "on":
dt = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(double.Parse(expr)).ToUniversalTime();
builder.Append("(" + colKey + ".Value.Day == " + dt.Day + " AND " + colKey +
".Value.Year == " + dt.Year + " AND " + colKey + ".Value.Month == " + dt.Month + ")");
case "noton":
builder.Append("!(" + colKey + ".Value.Day == " + dt.Day + " AND " + colKey +
case "after":
builder.Append("((" + colKey + ".Value.Year > " + dt.Year + " OR (" +
colKey + ".Value.Month > " + dt.Month + " AND " + colKey + ".Value.Year == " + dt.Year + ") OR (" +
colKey + ".Value.Day > " + dt.Day + " AND " + colKey + ".Value.Year == " + dt.Year + " AND " +
colKey + ".Value.Month == " + dt.Month + ")))");
case "before":
builder.Append("((" + colKey + ".Value.Year < " + dt.Year + " OR (" +
colKey + ".Value.Month < " + dt.Month + " AND " + colKey + ".Value.Year == " + dt.Year + ") OR (" +
colKey + ".Value.Day < " + dt.Day + " AND " + colKey + ".Value.Year == " + dt.Year + " AND " +
case "today":
builder.Append("(" + colKey + ".Value.Day == " + DateTime.Now.Day + " AND " + colKey +
".Value.Year == " + DateTime.Now.Year + " AND " + colKey + ".Value.Month == " + DateTime.Now.Month + ")");
case "yesterday":
DateTime yesterday = DateTime.Now.AddDays(-1);
builder.Append("(" + colKey + ".Value.Day == " + yesterday.Day + " AND " + colKey +
".Value.Year == " + yesterday.Year + " AND " + colKey + ".Value.Month == " + yesterday.Month + ")");
case "thismonth":
builder.Append("(" + colKey + ".Value.Year == " + DateTime.Now.Year + " AND " + colKey
+ ".Value.Month == " + DateTime.Now.Month + ")");
case "lastmonth":
builder.Append("(" + colKey + ".Value.Year == " + (DateTime.Now.Year) + " AND "
+ colKey + ".Value.Month == " + (DateTime.Now.Month - 1) + ")");
case "nextmonth":
+ colKey + ".Value.Month == " + (DateTime.Now.Month + 1) + ")");
case "thisyear":
builder.Append(colKey + ".Value.Year == " + DateTime.Now.Year);
case "lastyear":
builder.Append(colKey + ".Value.Year == " + (DateTime.Now.Year - 1));
case "nextyear":
builder.Append(colKey + ".Value.Year == " + (DateTime.Now.Year + 1));
case "true":
builder.Append(colKey + " == " + true);
case "false":
builder.Append(colKey + " == " + false);
default:
if (builder.Length > 0)
customers = customers.Where(builder.ToString(), new object[0]);
return customers;
internal List GetFilterExpressions(NameValueCollection queryString)
List expressions = new List();
// check the query string for sorting expressions
foreach (string key in queryString.Keys)
if (!string.IsNullOrEmpty(key) && key.StartsWith("filter("))
string columnKey = key.Substring(key.IndexOf("(")).Replace("(", "").Replace(")", "");
string logic = "";
if (queryString["filter"] != null && (queryString["filter"].ToLower() == "and" || queryString["filter"].ToLower() == "or"))
logic = queryString["filter"];
Regex filtersRegex = new Regex(@"[a-z]+\(.*?\)", RegexOptions.IgnoreCase);
MatchCollection m = filtersRegex.Matches(queryString[key]);
string[] filters = new string[m.Count];
int i = 0;
foreach (Match capture in m)
filters[i] = capture.Value;
i++;
// Handle multiple filters for the same column
for (i = 0; i < filters.Length; i++)
FilterExpression e = new FilterBLOCKED EXPRESSION;
return expressions;
Hello,
This is caused by the presence of brackets ( or ) in the searched string. We already have this in our internal system as a bug with #241738 and a fix will be available with the upcoming 17.2 release. As you are using 17.1, I updated the internal item so that it gets resolved for this major version as well. A support case is created on your behalf with number CAS-188030-D9Z1Q8, so that you can be notified when the bug is fixed. You can find your active cases under Account - Support Activity in our website. Select your ticket and go to Development Issues tab to view the status of related bugs.
I will update you through the newly created support case should there be any additional information regarding the issue. Thank you for using Infragistics forums!
Best regards,
Stamen Stoychev