Using Linq in Reports
Our sample projects and report templates can help you learn the basics of working with our products.The result of a LINQ query can be used as a report data source, so filtering, sorting and shaping happen in code before the report sees the data.
Query, then register. Build a LINQ query and pass it to the report as a business object:
How it works. Any
Query, then register. Build a LINQ query and pass it to the report as a business object:
var query = from i in items
where i.Price > 9.99
orderby i.Price
select i;
var report = new StiReport();
report.Load("Reports/Report.mrt");
report.RegBusinessObject("MyData", "MyData", query);RegBusinessObject(category, name, data)— registers an in-memory object sequence (here the query result) as a data source.- Because the query is lazily evaluated, the report renders against exactly the rows the query yields.
How it works. Any
IEnumerable LINQ result — projections, joins, groupings — becomes a data source, letting you pre-shape data with the full power of LINQ.