This example shows how to use the Linq queries in the report data. Linq syntax allows you to perform complex filtering, ordering and grouping operations when working with data sources, and using a minimum of code. For this, you can use the method for working with Business Objects:
private StiReport GetReport()
{
Item[] items = new Item[] {
new Book{Id = 1, Price = 13.50, Genre = "Comedy", Author = "Jim Bob"},
new Book{Id = 2, Price = 8.50, Genre = "Drama", Author = "John Fox"},
new Movie{Id = 1, Price = 22.99, Genre = "Comedy", Director = "Phil Funk"},
new Movie{Id = 1, Price = 13.40, Genre = "Action", Director = "Eddie Jones"}
};
var query1 = 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", query1);
return report;
}
In the screenshot below you can see the result of the sample code: