Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conversion from v.6 to v.XI not working for reports with sub reports

Status
Not open for further replies.

forumhelp

Programmer
Dec 13, 2005
17
US
Hi,

I am new to Crystal Reports. Currently working on the task to upgrade the crystal reports from version 6.0 to version XI. If anyone could help me with the tips on how should I upgrade, it would be very helpful. I have taken the following steps:
1. Open the report in version XI.
2. Reset the database location. Although the datasource would be modified at run time by the visual basic application, I am trying to change it to the new database. The reports are fetching the data from stored procedures.
3. Save the report in version XI rpt file.

The simple reports which are without any sub reports are working fine but the reports which have sub reports are not showing the data. Not even in the Preview Sample. Any help would be greatly appreciated.

Thanks in advance,
--ForumHelp
 
Hi Everyone,

Please go through the above question and suggest a solution. I have more than 60 reports and it is urgent to fix all by Friday.

Thanks for your time,
-Forumhelp
 
I've never seen version 6 of CR. It could be that subreport linking was handled differently back then. I know that CR 8 and 8.5 saved a bunch of connection junk with the reports, which made it a pain to switch databases by opening and resetting/repointing to the correct db's.

When you open the reports in CR XI, and go to Set Datasource Location, can you see the main report tables/procedures, as well as separate entries for the subreport tables/procedures?

What kind of connectivity/database are you working with (e.g. ODBC connection to SQL Server)? If you're using VB6 with SQL Server or Access, have a look at my FAQ (faq768-5374) on changing datasources at runtime. The same code could be used to reset the connection information for a batch of reports, and re-save them in CR XI (I did this for 100+ reports about six months ago).

-dave
 
Hi Dave,

Thanks for the reply. Yes, I am using ODBC to connect from visual basic 6 to sql server 2000. I have had a look on the your post to change datasource dynamically. I cannot use your code after all the reports are being converted to version XI because sometime when I change the dsn dynamically, I get an error to map unmatched fields which then I have to map manually. Once, I convert the reports then I can use your code to change from qa, production and development.
I don't know where I am going wrong in the converstion process. I will expain with an example. There is a report which shows candidate information. The fields on this report are from a stored procedure. In the detail section, a sub-report named telephone has been inserted which shows the information from a stored proc to show fields for telephone numbers. After conversion either I can see the candidate information and not telephone numbers OR both are missing. Before doing the "save as" in the new version, I have taken the following steps to covert.
1. Open the primary report, change the datasource location of the primary report and then change the datasource location of the sub report. Open the sub report, change the datasource location.
2. Open the primary report, change the datasource location of the sub report first and then the datasource of the primary report. Open sub report and change the datasource location.
3. Open sub report first, change the datasource location. Open primary report change the datasource location of the primary report and then the sub report datasource.
4. Open sub report first, change the datasource location. Open primary report and change the datasource location of the sub report first and then the primary report datasource.
5. Open primary report, change the datasouce of both primary report and sub report without explicitly changing the datasource of sub report.

Please help.
--Forumhelp
 
Hey Dave,

Found the problem but need your help to figure out the solution. I used sql profiler to see the trace. As a parameter to the primary report and sub report, I am using the username. When it runs the primary report then it passess my name but while passing the parameter to the sub report, it always passes the name of the person who used to work before me and who had initially started the conversion process. I believe that the parameter is not being taken by the sub report. How can I delete the existing parameter such that it accepts the parameter which another stored procedure is passing to it at run time?

Thanks,
--ForumHelp
 
Try looking at the username parameter in both the main and subreport, and make sure there aren't any default values set in there.

Are you sure the parameter actually exists within the subreport, i.e. it's not hardcoded?


-dave
 
Dave,

In the primary report, I did a reset of the datasource location for the sub report and it gave me the dialog box to enter the username. I kept it blank and selected the check box to set to null. Hence in the sql trance, not it is not showing me the old programmers name. But it is not accepting any parameter. I cannot figure out how we are assigning a parameter to the sub report. I am assigning a parameter of username in the primary report from my visual basic application. Do you have any solution if this can be done from within the report itself or do I have to write a separate code in visual basic to assign the parameter to the sub report?

Thanks,
--ForumHelp
 
Right click on the subreport > change subreport links, and see if the main report parameter is even linked to the subreport.

Also, did you say that you have a subreport in the Details section? Seriously inefficient...

-dave
 
Yes, the subreport is in the detail section. We are upgrading to version XI. I haven't worked on crystal reports a lot and it may be most inefficient but we are continuing it for the next release. If you can give me some ideas on how you prefer designing the report using stored proc, I can suggest the same to my team and possible we can improve it after the release. I am sorry for your dissappointment.

I right clicked on the sub report (in the detail section of the primary report) and clicked on change subreport links. The primary report is only passing the candidate id but it was not passing the username. I selected the username and it works fine. However, when I looked into the old reports which are in version 6. They are not passing the username from the report, it is done through the vb code. Can we do the same through vb code? I changed your code to change the datasource name and got it working but still it does not pass it as a parameter when I look into the sql trace. Here is the code which I have written to change the parameter of the sub report. Please suggest your feedback.

For i = 1 To crxSections.count
Set crxSection = crxSections(i)

For j = 1 To crxSection.ReportObjects.count

If crxSection.ReportObjects(j).Kind = crSubreportObject Then
Set crxSubreportObject = crxSection.ReportObjects(j)

'Open the subreport, and treat like any other report
Set crxSubReport = crxSubreportObject.OpenSubreport
'*****************************************
Set crxTables = crxSubReport.Database.Tables

With crxSubReport
For intI = 1 To .ParameterFields.count

If LCase(.ParameterFields(intI).Name) = "{?@hostname}" Then
.ParameterFields(intI).AddCurrentValue (gsHostName)
End If
Next intI

End With

End If

Next j

Next i
 
Looks like that should work at runtime. If the main report is also using the @hostname parameter, I'd use the subreport linking method, but that's just me. That way, you only have to worry about getting the parameter to the main report.

-dave
 
Thanks Dave,

Yes, I commented my code to assign the parameter from the frontend and used the subreport linking method.
I appreciate your ideas. Whenever you can, please give me an example of how you would use stored procedures in a report and how you would use subreports.

I will continue the conversion process and would get back to the forum incase I face any problem.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top