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;
}

Auf dem Screenshot unten Sie können das Ergebnis des Beispiel-Codes ansehen:

Using Linq in Reports

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.