This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Good morning, I am using LS, MVC3 and the telerik grid MVC. When using the ajax custom binding, I need to use the telerik expression builder to convert the filter descriptions which are passed through in the grid command object. Below is the query it is trying to run (the second where clause generated by the expression builder). { Query(FSPortal.Model.ProjectRespondentGrid) .Where(projresp => (projresp.ProjectId == value(FSPortal.RespondentRepository+_Closure$__20).$VB$Local_projectId)) .Where(item => ((IIF((item != null), item.Status, null) ?? "").ToLower() == "Complete".ToLower())) } The error I get is "LightSpeed does not support conditional expressions in this position where the test cannot be resolved on the client". Let me know if you need the full stack trace as well. Thanks in advance. |
|
|
Are you in control of the expression? That second Where clause could be simplified to read: .Where(item => item.Status.ToLower() == "Complete".ToLower()) which would solve the problem. (item will never be null, and the coalesce is irrelevant because the .ToLower() call gets translated to the SQL expression LOWER(ProjectRespondent.Status) which automatically handles NULLs. You'd need all the extra bits in LINQ to Objects, but not in LINQ to LightSpeed.) |
|
|
This is automagically generated by the telerik expression builder. Here is the stack trace at Mindscape.LightSpeed.Linq.Sqo.CriteriaSqo.ExtractConditionalCriteria(LinqQueryPlanExpression plan, ConditionalExpression condition) |
|
|
Hmm, from this thread: http://www.telerik.com/community/forums/aspnet-mvc/grid/expressionbuilder-in-grid.aspx it looks like changing the ExpressionBuilderOptions to turn off LiftMemberAccessToNull might help. However the thread implies that it might not work with strings for some reason (of course, they may have fixed this since then -- the thread is about a year old). Could you give it a try and let us know? |
|
|
We will also have an update in the next nightly build to work around this issue in case the LiftMemberAccessToNull trick doesn't work. |
|
|
Awesome Ivan... that'll be fantastic as I don't think the Normal 0 false false false EN-NZ X-NONE X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman","serif";}
LiftMemberAccessToNullcan be set without getting the Telerik source code and modifying it. I'll let you know how I get on. |
|
|
[quote user="ivan"] We will also have an update in the next nightly build to work around this issue in case the LiftMemberAccessToNull trick doesn't work. [/quote] Thanks Ivan and Mindscape. The change you made works a treat!
|
|