Skip to main content
Inspiring
September 30, 2013
Answered

sub report data source at run time

  • September 30, 2013
  • 1 reply
  • 2791 views

I have a sub report and on the main report and I want to set up sub report and main report data soruce using stored procedures.

I have following code, it only runs sub report, but not main report has sub report on it.

I would like to know any way to set sub report and main report to run a report which has sub report on it,

Your help and information is great appreciated,

Regards,

Iccsi, 

<cfreport format = "PDF" template= "subReport.cfr"

      query = "#mysubStored#">

  </cfreport>

 

 

   <cfreport format = "PDF" template= "MainReport.cfr"

      query = "#mydata#">

  </cfreport>

  </CFIF>

This topic has been closed for replies.
Correct answer EddieLotter

iccsi wrote:

I would like to know any way to set sub report and main report to run a report which has sub report on it,

If I understand you correctly, you want to pass a result-set to your subreport from the calling CFM script.

To do so, you need to give your subreport a unique name in the Report Builder and then you can do something like the following:

<cfreport format="PDF" template="MainReport.cfr" query="#mydata#">

     <cfreportparam subreport="SubReportName" query="#mysubStored#">

</cfreport>

1 reply

EddieLotter
EddieLotterCorrect answer
Inspiring
October 1, 2013

iccsi wrote:

I would like to know any way to set sub report and main report to run a report which has sub report on it,

If I understand you correctly, you want to pass a result-set to your subreport from the calling CFM script.

To do so, you need to give your subreport a unique name in the Report Builder and then you can do something like the following:

<cfreport format="PDF" template="MainReport.cfr" query="#mydata#">

     <cfreportparam subreport="SubReportName" query="#mysubStored#">

</cfreport>

iccsiAuthor
Inspiring
October 1, 2013

Thanks for the information and help,

It seems that the subreport query does not follow the order by in the stored procedure.

I want it sort by code, but it comes different order which does not make sense for the report.

Are there any particular way to make sure subreport query follow my order clause in the stored procedure?

Thanks again for helping,

Regards,

Iccsi,

EddieLotter
Inspiring
October 1, 2013

iccsi wrote:

It seems that the subreport query does not follow the order by in the stored procedure.

This is a different problem. It is best to start new threads with new problems.

Are you sure the result-set is sorted the way you expect? The reason I ask is because I don't think the report changes the result-set.

An easy way to verify is to look at the result-set returned from your stored proc to be sure what it looks like, for example:

<cfdump var="#mysubStored#">

<cfabort>