Insufficient information provided--probably. The subreport would have to be in GH_a, and then a shared variable passed to GH_b. You would create a formula in the subreport like the following and place it in the subreport report footer:
whileprintingrecords;
shared numbervar x := sum({table.amt});
In the group header_b section you could then reference that amount and work with it in further calculations, like:
whileprintingrecords;
shared numbervar x;
{maintable.amount} % x
If you need further help, you should provide your CR version, and a description of your report structure: groups, where the subreport is located, how it is linked, etc.
got it working. I am using CR that comes with Visual Studio.Net 2001.
Another small problem surfaced since I began using sub-report for this report. Login dialog prompting for userid, pwd, db, server shows up. I have the following routine that used to work when there was no sub-report. What can I do to pass this info to the sub-report so the login dialog don't show up.
Thanks much.
Private Sub ApplyLogOnInfo(ByVal crdb As Database)
Dim crConnectionInfo As ConnectionInfo
Dim crTableLogOnInfo As TableLogOnInfo
Dim crTables As Tables
Dim crTable As Table
Dim ologin As New Login()
'Setup the connection information structure to be used
'to log onto the datasource for the report.
crConnectionInfo = New ConnectionInfo()
With crConnectionInfo
.ServerName = server
.DatabaseName = database
.UserID = userName
.Password = password
End With
crTables = crdb.Tables
'Loop through all tables in the report and apply the connection
'information for each table.
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
Got it working by passing login info to subreports.
Dim crSections As Sections
Dim crSection As Section
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim crSubreportObject As SubreportObject
Dim crReportDocument As CrystalReport1
Dim crSubreportDocument As ReportDocument
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectioninfo As ConnectionInfo
'pass the necessary parameters to the connectionInfo object
With crConnectioninfo
.ServerName = ServerName
.UserID = UserID
.Password = Password
.DatabaseName = DatabaseName
End With
'set up the database and tables objects to refer to the current report
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
'loop through all the tables and pass in the connection info
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectioninfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
'set the crSections object to the current report's sections
crSections = crReportDocument.ReportDefinition.Sections
'loop through all the sections to find all the report objects
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
'loop through all the report objects to find all the subreports
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject Then
'you will need to typecast the reportobject to a subreport
'object once you find it
crSubreportObject = CType(crReportObject, SubreportObject)
'open the subreport object
crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
'set the database and tables objects to work with the subreport
crDatabase = crSubreportDocument.Database
crTables = crDatabase.Tables
'loop through all the tables in the subreport and
'set up the connection info and apply it to the tables
For Each crTable In crTables
With crConnectioninfo
.ServerName = ServerName
.DatabaseName = DatabaseName
.UserID = UserID
.Password = Password
End With
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectioninfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
End If
Next
Next
'view the report
CrystalReportViewer1.ReportSource = crReportDocument
Me.WindowState = FormWindowState.Maximized
'Add any initialization after the InitializeC
Maybe someone else can help you with that. Within CR, you could go to database->set location and under the properties for the subreport->use dsn default properties: change false to true.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.