Replace a database connection for report and all subreports - crystal-reports

Is there is any way to change the datasource location for a report and all of it's subreports without having to open each of them manually?

Here is how I set my connections at runtime. I get the connection info from a config location.
#'SET REPORT CONNECTION INFO
For i = 0 To rsource.ReportDocument.DataSourceConnections.Count - 1
rsource.ReportDocument.DataSourceConnections(i).SetConnection(crystalServer, crystalDB, crystalUser, crystalPassword)
Next
For i = 0 To rsource.ReportDocument.Subreports.Count - 1
For x = 0 To rsource.ReportDocument.Subreports(i).DataSourceConnections.Count - 1
rsource.ReportDocument.OpenSubreport(rsource.ReportDocument.Subreports(i).Name).DataSourceConnections(x).SetConnection(crystalServer, crystalDB, crystalUser, crystalPassword)
Next
Next

If you are just doing this as a one-shot deal, my suggestion might not help. But, if you change data sources frequently, it might be useful.
Disclaimer: I haven't worked with Crystal since version 9.0, so I don't know if they have improved on this. I always used UDL files. Basically, it is a pointer to a data source. Set up your report to point to the UDL, and the UDL points to the data source. If the source changes, just update the UDL.
This is incredibly useful if you have multiple reports. You only have to update one file when the server changes.

Linked sub-reports (at least in CR XI) share the main report's datasource - presumably your report is already configured so that's not an option for you?

#Unsliced I think the problem he is getting at is when you take a crystal report someone developed against another database, and you bring it up in Crystal Reports XI, you have to do a Change Datasource for each field, including those in subreports. If you just change source on the top level of the report, it often errors. (I think that is a known issue in Crystal Reports).

I'm guessing you're talking about .rdl files from Reporting Services? (If not, my answer might be wrong)
They're basically just XML, so you could load each one of them in and do an XPath query to get the node that contains the datasource and update it.

Related

crystal report 8.5 filter records

I am new to this position (production support) and asked to look into a problem in a crystal report 8.5. I am new to crystal report as well with some basic training only.
The report seems to be missing some records. It uses a SQL Server 2005 procedure as data source. I tested with same parameters the report used on the procedure and the it returns all records including the missing records in the report. So I think the report must filter the records. Then I checked Record Selection Formula, I saw something in there but it seems not related to the missing records. For testing, I commented them all, run the report but the records are still missing.
So I guess there may be something else that filters the data?
It turns out to be something in top N group expert. The report only lists top 50 items for a group based on sales units.
You might benefit from exporting the report definition into a .txt file by clicking file > export > export report > report definition txt ( you have to scroll for it). I believe this functionality existed back in 8.5.
What it does is display the underlying formatting, filtering and formulas in an easy to read format. You should be able to pick out what is happening much more quickly than clicking through all the potential places for something to be hidden. I see that you answered your own question but seeing that you're new to this position this is a troubleshooting tip I found invaluable.

SSRS 2008 - Expand and Collapse subreports

I am dealing learning SSRS 2008. I want to do a report that is a little bit more complex.
I would like to have a row with information about "Object": name, id, description, etc. And I would like to have a + sign in this row, so I can expand/collapse rows that are regarding "Comments" about that object, with columns like "comment", "date", etc.
I first tried the "Grouping" approach, but I got to a dead end because the groups would use the same header.
Now I am trying to tackle it with a subreport.
The first problem I had is that I couldn't find the query designer in VS2008, so I started the SQL Reporter Builder.
Is there any way to use the Query Designer inside VS2008?
Then I created my report and my subreport as different report files, because I thought I would be able to use the subreport properties to select the subreport file and add it, but I was wrong. How can I add it? Do I have to publish it?
I just found out that I can't use the rdl file from SQL Report Builder in Visual Studio (it doesn't recognize the file extension, in VS2008 it is rdlc).
I am basically lost.
Could someone give me some guidance?
Thanks,
Oscar
This was asked a while ago but you haven't closed the question so I assume you still need an answer.... Are you looking to add the drill down feature to your report?
http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/creating-a-basic-drilldown-report-in-ssr-2005
http://www.sqlservercurry.com/2009/08/creating-drill-down-report-with-sql.html
If not... I am confused at what you are looking for and if what you want is really intended to be done in SSRS.
And... are you using subreports because the Object information and the Comment information is on different servers or data sources? Because it seems like you would want to use grouping for this, and group by the objectID and have the comments below.

Use multiple datasource in one crystal report

I am using crystal reports 2008, I want to use multiple data sources in one report. One is connecting informix and another is connecting redbrick data source. Both are independent data source and doesnt have any common value to co -relate them. Can we have that option?
Pleae advice?
Have you tried it already? Crystal Reports allows you to add tables, via Database Expert, from multiple datasources. It will warn you that it may not work, but many times it does.
I had the same problem.
But now its OK after using subreport.
ie. Create the subreport with just the details section and put in inside the main report.
According to my colleague,
For "independent data sources", that have no relationship at all,
we should use subreport.

Crystal Reports: Using Business Objects xi Datasource

I'm a total Crystal Reports/Business Objects newbie...
I've been tasked with going through 100 or so Crystal Reports to determine which reports are using an 'embedded' connection string vs. one supplied by the BOXi server.
I've installed Crystal Reports and accessed a sampling of the reports, but haven't been able to locate any references to a Repository based connection string/datasource.
Can anyone point me towards where this configuration is managed?
Thanks!
Richard
I don't know if you've already tried this or even if it's too basic for you, but it's been 24 hours, so here's my 2 cents:
To see the data source of each report, open them up and go to the Database at menu at top. There, you'll want to browse through the "Database Expert", "Set Datasource Location", and "Show SQL Query" options. Look at the properties of each data source.
You may also want to make a practice report pulling data from your sources of interest. That can help you get used to CR.
when you deploy the report to BO, you use the CMC (central management console) to set the database connection information. it is here that you will find the answer to your connection-string question.

Subreports are not getting printed

I tried to create a very simple report with a subreport. The subreport was created separately and was embedded in the data group. The subreport separately gives me the relevant data. and the other main report gives me the intended partial data. But the data intended in the place where the subreport has been embedded is not appearing. It is appearing as blank in the output. Can anybody advise ?
You are probably not sending the sub report the data/parameters it needs to be generated.
maybe there is no data to your query in the subreport?
by default in ireport, a report has no page when the query returns no records.
you could setup a NoDataMessage, i have outline the steps in my other question/post
Today I had faced the same situation using ireport 3.0.0 and Oracle JDBC.
The work around (kludge) was to set at query at the master report: select * from dual.
Yeah, I do realize that definetely is not the right way, but it help me out. Seems that the master (main) report was not open the data base connection, then the subreport that was configured to use the same connection was not finding anything!
Hope that it help someone else...