This is a migrated thread and some comments may be shown as answers.

Subreport Will Not Show Any Data But Shows Data As A Stand Alone

3 Answers 124 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Malcolm
Top achievements
Rank 1
Malcolm asked on 15 Nov 2012, 02:09 PM

Hello everyone. I have a situation where I have created a master summary report with 2 detail sub reports in it. One of my 2 sub reports refuses to show any data. It is configured the same as the 2nd sub report with its parameters properly being passed along but I get bupkis.

I can run the sub report in question by its self and it will display data beautifully but not when I add it as a sub report to my master report.

I found some code while searching the forum to display a custom message when my sub report has no data and using that I have verified that the sub report is just not getting any data back when run.

Any ideas here to help me get over this hump?

3 Answers, 1 is accepted

Sort by
0
Malcolm
Top achievements
Rank 1
answered on 15 Nov 2012, 04:18 PM

Just wanted to update with some additional information. I have taken a few snap shots to show what I am dealing with. I figure it can't hurt to show as much info as I can. Please let me know if there is something more I can supply!

Sub Report Report Parameters Setup

Result of running Master Report with Sub Report

Sub Report Run As Stand-Alone Report Results

Thanks again to everyone who helps!

Malcolm

0
Steve
Telerik team
answered on 20 Nov 2012, 11:57 AM
Hi Malcolm,

I see that two of your detail report parameters receive parameters from the master report as value, these parameters have to be from the same type and should have a value set. Setup three textbox items in your SubReport that would display the values of the report parameters to see what you receive from the master. From your screenshot, we notice that one of the master report parameter values is different when ran as master-detail and when ran as a standalone. If you have filters applied in the SubReport, check them as well and make sure they are not filtering all data regardless of parameter values.

All the best,
Steve
the Telerik team

HAPPY WITH TELERIK REPORTING? Do you feel that it is fantastic? Or easy to use? Or better than Crystal Reports? Tell the world, and help fellow developers! Write a short review about Telerik Reporting and Telerik Report Designer in Visual Studio Gallery today!

0
Malcolm
Top achievements
Rank 1
answered on 28 Nov 2012, 08:20 PM

Hello all. I just wanted to follow up on this thread because I found a solution and wanted to pass it along to others.

It turns out the issue preventing my subreport from displaying data was pretty simple. In the subreport in question I was populating my data using code ala;
Public Function GrabBonusReportData(PayDayDate As Date, CompanyID As Integer) As DataTable
 
    Try
 
        Dim oCommand As New SqlCommand()
        Dim oAdapter As New SqlDataAdapter(oCommand)
        Dim oData As New DataTable("BONUS_REPORT_SUMMARY_DATA")
 
        oCommand.CommandType = CommandType.StoredProcedure
        oCommand.CommandText = "prod.dbo.BONUS_REPORT_SUMMARY_DATA"
        oCommand.Connection = _Conn
 
        oCommand.Parameters.AddWithValue("@PayDay", PayDayDate)
        oCommand.Parameters.AddWithValue("@CompanyRecID", CompanyID)
 
        _Conn.Open()
 
        oAdapter.Fill(oData)
 
        _Conn.Close()
 
        Return oData
 
    Catch ex As Exception
 
        If _Conn.State = ConnectionState.Open Then
 
            _Conn.Close()
 
        End If
 
        frmParent.ErrorLog.LogError(ex)
 
        Return Nothing
 
    End Try
 
End Function

This was the root of my problem. I threw this data into a SQLDATASOURCE object and my subreport fired off perfectly. I am not sure at all why this is but for future reference, when constructing a report that will be used as a subreport else where, be sure to put your data into a SQLDATASOURCE object.

Thanks!

Malcolm
Tags
General Discussions
Asked by
Malcolm
Top achievements
Rank 1
Answers by
Malcolm
Top achievements
Rank 1
Steve
Telerik team
Share this question
or