LINQ in Report
Posted: Mon Sep 03, 2012 11:53 am
Hello.
I am wondering is it possible to use Linq in Report?
For example using Linq query in TextField to display data: .Where(x => x.Id == 2).First() or something like that.
In my report I have business object that contains some field. One of this fields is Id_a. I have also list of object with fields: Name, Id_b. I want to display Name if Id_b == Id_a.
In C# this code look something like this:
var tmp = object_a.Where(x => x.Id == object_b.Id).FirstOrDefault();
string name = tmp != null ? tmp.Name : string.Empty;
Is it possible to do something like that in report?
I added "using System.Linq" in code, but when i was trying to use "Where" query i got error that business object does not contain defintion for "Where".
Perhaps I am doing something wrong and I should add this query in other place, but I am not sure where.
If you have trouble with understand what I want to achive, I can try make some project to show it.
Thank you in advance.
I am wondering is it possible to use Linq in Report?
For example using Linq query in TextField to display data: .Where(x => x.Id == 2).First() or something like that.
In my report I have business object that contains some field. One of this fields is Id_a. I have also list of object with fields: Name, Id_b. I want to display Name if Id_b == Id_a.
In C# this code look something like this:
var tmp = object_a.Where(x => x.Id == object_b.Id).FirstOrDefault();
string name = tmp != null ? tmp.Name : string.Empty;
Is it possible to do something like that in report?
I added "using System.Linq" in code, but when i was trying to use "Where" query i got error that business object does not contain defintion for "Where".
Perhaps I am doing something wrong and I should add this query in other place, but I am not sure where.
If you have trouble with understand what I want to achive, I can try make some project to show it.
Thank you in advance.