Changing data source

Stimulsoft Ultimate discussion
Post Reply
David Renner
Posts: 15
Joined: Thu Jul 01, 2021 5:21 pm

Changing data source

Post by David Renner »

I need to change my data source and point it to another database server that has the same sql as the original. When doing so, it breaks my entire report. The current data source has a several Relations. Is there a trick to doing this where i won't have to rebuild the entire report? In Crystal they had a feature where you could swap out a db.
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Changing data source

Post by Lech Kulikowski »

Hello,

You can change the connection string in your report in the designer or from code:
((StiSqlDatabase)report.Dictionary.Databases[ "ConnectionName"]).ConnectionString = "newString";

Thank you.
David Renner
Posts: 15
Joined: Thu Jul 01, 2021 5:21 pm

Re: Changing data source

Post by David Renner »

I am using the desktop app, latest Ultimate version. How do i change it via code?
David Renner
Posts: 15
Joined: Thu Jul 01, 2021 5:21 pm

Re: Changing data source

Post by David Renner »

a little more info, one group has 7 data sources with 4 relations, a second group 3 data sources. What i want to do is move one data source from group 1 and put it in group 2. When i do this through the UI, the report breaks and its a very complex report. The difference between the 2 groups is they connect to different servers.
I am doing this because one of the data sources connects to a stored procedure that i cannot make changes to. I created another data source that has the data that i want. I made a relation that should pull data from the new data source using a unique key but it doesn't work. If i can connect the new data source to the report i can get what i want but right now it breaks the report, sub reports, grouping etc...I manually started to relink/fix everything but it still isn't working correctly. I can send you the report, but not the company confidential data so i don't know if that would do you any good.
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Changing data source

Post by Lech Kulikowski »

Hello,

Could you send us your report for analysis or screenshots that show which groups do you mean.

Thank you.
David Renner
Posts: 15
Joined: Thu Jul 01, 2021 5:21 pm

Re: Changing data source

Post by David Renner »

The highlighted data source is a MSSQL server, it executes a Stored Procedure. I don't have privilege's to edit that stored procedure. So i copied it, add one line of code to pull in one additional column and now that data source is linked to Midnight_Procs2 (not shown in picture). I kept all the names the same and tried to redo the Relations etc. No matter what, the report breaks.
Screenshot 2021-12-29 070041.png
Screenshot 2021-12-29 070041.png (25.51 KiB) Viewed 2205 times
I'd rather handle all of this by using a Relation but it doesn't work (all though my other Relations work). Here is how that likes. The data source is named SD, it executes sql. I created a Relation with WorkOrderDetailList_Report and named it SD. Its linked by the column OrderVersionDetailID.
Screenshot 2021-12-29 065924.png
Screenshot 2021-12-29 065924.png (68.15 KiB) Viewed 2205 times
No matter how i set the Parameter up, it doesn't work. I tried setting the VAR OrderVersionDetailID to be what the current OrderVersionDetailID is from WorkOrderDetailList_Report and that is correct (see image) but no matter what i try i can't get the SD Relation to pick up that number correctly. I tried setting the parameter of the SD Relation to the VAR OrderVersionDetailID and tried setting it to WorkOrderDetailList_Report.OrderVersionDetailID. In the image below, the 4 digit number should match. WorkOrderDetailList_Report.OrderVersionDetailID and the var OrderVersionDetailID match but the SD number does not.
Screenshot 2021-12-29 065653.png
Screenshot 2021-12-29 065653.png (89.92 KiB) Viewed 2205 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Changing data source

Post by Lech Kulikowski »

Hello,

You can change the NameInSource property to change connection "group".

Thank you.
Attachments
Screenshot 2021-12-30 093959.jpg
Screenshot 2021-12-30 093959.jpg (171.25 KiB) Viewed 2189 times
David Renner
Posts: 15
Joined: Thu Jul 01, 2021 5:21 pm

Re: Changing data source

Post by David Renner »

That worked. Thanks!
Andrew
Posts: 4104
Joined: Fri Jun 09, 2006 3:58 am

Re: Changing data source

Post by Andrew »

Hello,

Great! You are welcome!
Post Reply