This example shows how to use a User Data object. First, load scripts:
@using Stimulsoft.Base
@using Stimulsoft.Report
@using Stimulsoft.Report.Blazor
@using Stimulsoft.Report.Web

Next, add report viewer:
<!--Report Viewer-->
<StiBlazorViewer Report="@Report" />

After that, create empty report object and load report template:
@code
{
    //Report object to use in Viewer
    private StiReport Report;

    protected override void OnInitialized()
    {
        base.OnInitialized();

        //Create report object and load template
        this.Report = new StiReport();
        this.Report.Load("Reports/UserData.mrt");

...

Next, create user data and register it in the report template:
...

	 	//Create user data
        var stiUserData1 = new Stimulsoft.Report.Dictionary.StiUserData();
        stiUserData1.Columns.AddRange(new Stimulsoft.Report.Dictionary.StiDataColumn[] {
            new Stimulsoft.Report.Dictionary.StiDataColumn("Name", "Name", "Name", typeof(string), null),
            new Stimulsoft.Report.Dictionary.StiDataColumn("Value", "Value", "Value", typeof(string), null)});
        stiUserData1.Count = 5;
        stiUserData1.GetData += new Stimulsoft.Report.Dictionary.StiUserGetDataEventHandler(stiUserData1_GetData);

        //Register new data in the report template
        this.Report.RegData("UserData", stiUserData1);
    }
	
...

Finally, use user data arrays:
...

	//User data arrays
    private string[] nameArray = new string[] { "Mahesh Chand", "Mike Gold", "Raj Beniwal", "Praveen Kumar", "Dinesh Beniwal" };
    private string[] valueArray = new string[] { "00", "01", "02", "03", "04" };

    private void stiUserData1_GetData(object sender, Stimulsoft.Report.Dictionary.StiUserGetDataEventArgs e)
    {
        if (e.ColumnName == "Name") e.Data = nameArray[e.Position];
        if (e.ColumnName == "Value") e.Data = valueArray[e.Position];
    }
}

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

Using User Data 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.