This is a migrated thread and some comments may be shown as answers.

Help With Expressions

4 Answers 91 Views
ExpressionEditor
This is a migrated thread and some comments may be shown as answers.
Gerry Leco
Top achievements
Rank 1
Gerry Leco asked on 04 Nov 2014, 03:55 PM
For simple things like adding two numeric columns I'm in good shape but I have two use cases that I can't seem to figure out how to express.
The data structure is an Account object at the root that has 1 or more Detail child objects.  Detail has a few different string properties.
What I want to be able to do is filter down to Account rows where it has at least one Detail object where its property is equal to a certain string.
In C# it would be like this:
var foo = db.Accounts.Where(a => a.Details.Any(b => b.HCPCS == "55555"));

Also,
I wanted to know if there way any way to cast strings to ints in the editor.
Something like
int.Parse(Field) > 50

4 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 06 Nov 2014, 01:25 PM
Hi Gerry,

Here is the help article indicating how you can define Lambda expressions via RadExpressionEditor. 

You still need to reset the Item of the editor to the root ViewModel that will contain the base of the query in order for it to work. 

Hope this helps. 

Regards,
Nick
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Gerry Leco
Top achievements
Rank 1
answered on 06 Nov 2014, 03:26 PM
Yes, I read the documentation, it did help with this case.
0
Gerry Leco
Top achievements
Rank 1
answered on 06 Nov 2014, 03:29 PM
Did not help I meant to say.  I need to be able to get at a certain property in the child object for filtering.
0
Nick
Telerik team
answered on 07 Nov 2014, 12:36 PM
Hi Gerry,

The help article actually specifies how you can mod your query in order for it to work:
Tasks.Where(SubTasks.Count > 2)

SubTasks is a collection that is part of every Task. The query you see is the same as:
item => item.Tasks.Where(param0 => param0.SubTasks.Count > 2)

As to the custom nature of your query, you will probably have to experiment a bit in order to get the exact syntax you need. 

Regards,
Nick
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ExpressionEditor
Asked by
Gerry Leco
Top achievements
Rank 1
Answers by
Nick
Telerik team
Gerry Leco
Top achievements
Rank 1
Share this question
or