Sending connection string to subreport?

Stimulsoft Reports.WEB discussion
Post Reply
DavidLee82
Posts: 19
Joined: Wed Jul 03, 2024 12:52 am

Sending connection string to subreport?

Post by DavidLee82 »

I have put together a report that has an embedded subreport. Can I know how do I pass the connection string from my main report to the subreport? At the moment the subreport is using a hardwired connection string which works but I'd like to be able to control the subreport's connection strings as well if possible.

Thanks.
Lech Kulikowski
Posts: 7664
Joined: Tue Mar 20, 2018 5:34 am

Re: Sending connection string to subreport?

Post by Lech Kulikowski »

Hello,

How do you want to provide a connection string to the subreport? From the code of your app?

Thank you.
DavidLee82
Posts: 19
Joined: Wed Jul 03, 2024 12:52 am

Re: Sending connection string to subreport?

Post by DavidLee82 »

Hi,

I would like the connection string be propagated from the main report to the subreport if that's possible. The main report already receives the connection string from my app during the rendering phase, and the main report is supposed to invoke the subreport for each group of items.

(This is largely related to the report with the crosstab/table we discussed last year, we have recently found that the crosstab is for some reason not able to be used together with groups and the workaround we devised was to use it as a subreport invoked for each group in the main report).
Lech Kulikowski
Posts: 7664
Joined: Tue Mar 20, 2018 5:34 am

Re: Sending connection string to subreport?

Post by Lech Kulikowski »

Hello,

If your subreport is embedded, then it shares the same dictionary as the main report, and you can set the connection string from code.
If it is external, then you can load it and change the connection string directly in the Subreport.

Thank you.
DavidLee82
Posts: 19
Joined: Wed Jul 03, 2024 12:52 am

Re: Sending connection string to subreport?

Post by DavidLee82 »

Hi,

Can you provide sample code on how to do that? The subreport is embedded, but as a resource instead of a subreport.

Edit: Attached is a copy of the report with the connection strings removed. Also attached is the SQL function used by the subreport to generate it's matrix.

Edit2: Forgot to attach a function that the matrix function is dependent on.
Attachments
fn_MakeSenseOfLocationName.txt
(1.49 KiB) Downloaded 7 times
fn_GetPalletsInLocation.txt
(6.26 KiB) Downloaded 9 times
WSF_ReceivingReport.mrt
(61.99 KiB) Downloaded 7 times
Lech Kulikowski
Posts: 7664
Joined: Tue Mar 20, 2018 5:34 am

Re: Sending connection string to subreport?

Post by Lech Kulikowski »

Hello,

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

Thank you.
Post Reply