This example shows how to create a report with the Business Objects collection. Business Objects is an object class data with which the data can be presented in different structures: tables, lists, arrays, etc. This example uses two variants of Business Objects - IEnumerable and ITypedList.

For example, create two different views - ViewIEnumerable and ViewITypedList. Each of these views has its own GetReport action handler. Also you need to define the ViewerEvent action:
@using Stimulsoft.Report.Mvc;

...

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
{
	Actions =
	{
		GetReport = "GetReportIEnumerable",
		ViewerEvent = "ViewerEvent"
	}
})

...

@Html.StiNetCoreViewer(new StiNetCoreViewerOptions()
{
	Actions =
	{
		GetReport = "GetReportITypedList",
		ViewerEvent = "ViewerEvent"
	}
})

Also we need to add these actions in the controller. The GetReportIEnumerable action loads the IEnumerable report and register data for it. In a similar way, the GetReportITypedList action loads the ITypedList report and register data for it:
public IActionResult GetReportIEnumerable()
{
	var report = new StiReport();
	report.Load(StiNetCoreHelper.MapPath(this, "Reports/BusinessObjects_IEnumerable.mrt"));
	report.RegData("EmployeeIEnumerable", CreateBusinessObjectsIEnumerable.GetEmployees());

	return StiNetCoreViewer.GetReportResult(this, report);
}

public IActionResult GetReportITypedList()
{
	var report = new StiReport();
	report.Load(StiNetCoreHelper.MapPath(this, "Reports/BusinessObjects_ITypedList.mrt"));
	report.RegData("EmployeeITypedList", CreateBusinessObjectsITypedList.GetEmployees());

	return StiNetCoreViewer.GetReportResult(this, report);
}

The ViewerEvent action handles all the viewer events (switching pages, zooming, printing, exporting, interactivity, etc.) and returns the answer to the client using the ViewerEventResult() static method:
public IActionResult ViewerEvent()
{
	StiNetCoreViewer.ViewerEventResult(this);
}

На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

Using Business Objects in the Report

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.