Can i do this in reporting services

  • I have a main report and some subreports.

    What i want to achieve is the subreports would be dynamically sent parameters to and the layout would change depending on some

    parameters sent from the main report.

    So there ia going to be a main report that is constant but the subreports data and layout could change.

    Another question is can i have an expression that would hide a subreport if there is no data in the subreport?

    Any ideas would be appreciated

  • The way to send parameters from the main report to the sub report is to click on the subreport control in the main report. Click properties and navigate to the parameters tab. The heading 'Parameter Name' corresponds to the subreport's parameters and the heading 'Parameter Value' should be the value from the Main Report you want to send to the subreport. Note, you will have to setup parameters in the subreport according to the exact names you have listed corresponding to the 'Parameter Name' heading. However, once you have set this up you should be able to use the subreport parameters normally even though the values are coming from the main report.

    I am not sure about the second part of your question. "Another question is can i have an expression that would hide a subreport if there is no data in the subreport?"

  • Thanks for the reply.

    I have done eaxctly what you posted.

    Sorry i didn't mention that i would like to do this from an asp.net page

    using a localreport or a serverreport.

    But my sceanrio would be in a serverreport.

    aktikt (4/17/2008)


    The way to send parameters from the main report to the sub report is to click on the subreport control in the main report. Click properties and navigate to the parameters tab. The heading 'Parameter Name' corresponds to the subreport's parameters and the heading 'Parameter Value' should be the value from the Main Report you want to send to the subreport. Note, you will have to setup parameters in the subreport according to the exact names you have listed corresponding to the 'Parameter Name' heading. However, once you have set this up you should be able to use the subreport parameters normally even though the values are coming from the main report.

    I am not sure about the second part of your question. "Another question is can i have an expression that would hide a subreport if there is no data in the subreport?"

  • On hiding the subreport, I dont know whether or not the option to collapse if there is no data is available. However it would be possible in the main report to create a dataset that returns the count of records from the subreport query, then depending on if the count is 0 or not, hide the subreport by setting the Visible property of the subreport to an iif statement based on the value of the count.

    i.e. iif(First(countDataSource.Count) = 0,False,True)

    Something like this may work.

  • iif(First(countDataSource.Count) = 0,False,True) would display the subreport with zero records, since the subreport displays when visibility equates to false (A quirk with SSRS)

    The correct pseudo code would iif(First(countDataSource.Count) = 0,True,False)

  • Hi 🙂

    I think for second issue...we can try something like...

    Under the visibility property of SubReport (through the place where you are trying to bind the subreport)...you can try.. writing an expression

    =IIF(ISNOTHING("SubRptDS"),TRUE,FALSE)..where SubRptDS is the dataset which has been used within a concerned SubReport...

    Cheers,

    Niraj

  • Hi *,

    I am attempting to do the same thing and tried the

    =IIF(ISNOTHING("srptML_Invoices"),TRUE,FALSE) idea but didn't work for me.

    Any other suggestions other than getting the count?

    Thanks,

    Eric

    Hi again,

    The count option works but the report shows blank space (where the hidden data) is displayed. Is there a way to roll up the displayed information?

    Thanks!

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply