Blazor - Webassembly Project how to set up Dataadapter

Stimulsoft Reports.NET discussion
sawyerlin
Posts: 6
Joined: Fri Apr 16, 2021 3:54 am

Blazor - Webassembly Project how to set up Dataadapter

Post by sawyerlin »

Hello Simulsoft team,

We are moving stimulsoft from old WFP to new Blazor WASM project. In our old WFP, we have set up custom datasource for that WPF client can send sql query to our api server for querying data (this proxy has been set up due to firewall configuration which disallow client to access directly the database).

Same case for the Blazor WASM, the client will not be allowed to access directly the database server. I've found this https://github.com/stimulsoft/Samples-J ... 0databases interesting link which allows JS reporter to communicate with the server by passing the command sql. So I am wondering how should we do it with Blazor WSAM. Appreciate if the team could help sharing some sample code or give some guidance.

Best
sawyerlin
Posts: 6
Joined: Fri Apr 16, 2021 3:54 am

Re: Blazor - Webassembly Project how to set up Dataadapter

Post by sawyerlin »

Hi Lech,

Thank you for the replay, actually I've consulted these two repos but not able to find the example for integrating custom database and adapter by extending
- StiSqlDatabase
- StiSqlAdapterService

Could you help providing sample code for the blazor if possible.

Actually, we've created our custom datasource based on these two classes in our WPF project.

Thank you
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Blazor - Webassembly Project how to set up Dataadapter

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
#3920
sawyerlin
Posts: 6
Joined: Fri Apr 16, 2021 3:54 am

Re: Blazor - Webassembly Project how to set up Dataadapter

Post by sawyerlin »

Hi lech,

Thanks a lot for the info provided, could you please keep me updated for that we can make the decision ASAP.

Best
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Blazor - Webassembly Project how to set up Dataadapter

Post by Lech Kulikowski »

Hello,

Ok.
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Blazor - Webassembly Project how to set up Dataadapter

Post by Lech Kulikowski »

Hello,

Please check the following code:

Code: Select all

protected override Task OnInitializedAsync()
    {
         var report1 = new StiReport();
         report1.Load(@"UserData.mrt");

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

        Report1.RegData("UserData", stiUserData1);

        return base.OnInitializedAsync();
    }

    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];
    }
Thank you.
Attachments
UserData.mrt.txt
(9.5 KiB) Downloaded 126 times
sawyerlin
Posts: 6
Joined: Fri Apr 16, 2021 3:54 am

Re: Blazor - Webassembly Project how to set up Dataadapter

Post by sawyerlin »

Hi lech,

It looks great, let me have a test.

Thank you for the info
Lech Kulikowski
Posts: 6238
Joined: Tue Mar 20, 2018 5:34 am

Re: Blazor - Webassembly Project how to set up Dataadapter

Post by Lech Kulikowski »

Hello,

You are welcome!
sawyerlin
Posts: 6
Joined: Fri Apr 16, 2021 3:54 am

Re: Blazor - Webassembly Project how to set up Dataadapter

Post by sawyerlin »

hi lech,

May I ask the plan of blazor documentation guide developer. As right now cannot really find it from the documentations site. I think a complete doc or examples which covers all necessary features could make the usage of this solution easier.
Post Reply