Changing data source
-
- Posts: 15
- Joined: Thu Jul 01, 2021 5:21 pm
Changing data source
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.
-
- Posts: 6272
- Joined: Tue Mar 20, 2018 5:34 am
Re: Changing data source
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.
You can change the connection string in your report in the designer or from code:
((StiSqlDatabase)report.Dictionary.Databases[ "ConnectionName"]).ConnectionString = "newString";
Thank you.
-
- Posts: 15
- Joined: Thu Jul 01, 2021 5:21 pm
Re: Changing data source
I am using the desktop app, latest Ultimate version. How do i change it via code?
-
- Posts: 15
- Joined: Thu Jul 01, 2021 5:21 pm
Re: Changing data source
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.
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.
-
- Posts: 6272
- Joined: Tue Mar 20, 2018 5:34 am
Re: Changing data source
Hello,
Could you send us your report for analysis or screenshots that show which groups do you mean.
Thank you.
Could you send us your report for analysis or screenshots that show which groups do you mean.
Thank you.
-
- Posts: 15
- Joined: Thu Jul 01, 2021 5:21 pm
Re: Changing data source
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.
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.
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.
-
- Posts: 6272
- Joined: Tue Mar 20, 2018 5:34 am
Re: Changing data source
Hello,
You can change the NameInSource property to change connection "group".
Thank you.
You can change the NameInSource property to change connection "group".
Thank you.
- Attachments
-
- Screenshot 2021-12-30 093959.jpg (171.25 KiB) Viewed 2251 times
-
- Posts: 15
- Joined: Thu Jul 01, 2021 5:21 pm
Re: Changing data source
That worked. Thanks!
Re: Changing data source
Hello,
Great! You are welcome!
Great! You are welcome!