locked
Report with subreport RRS feed

  • Question

  • Hello you all,

    I have Main report which contain 3 Subreports. All reports based on Queries. All sources table has Date Field.The main Report Source table has only 1 recorday per day while the other source tamles have at least 20 t0 30 records per day. every Query has perameter to enter Date from user to retrive report of that entered date.

    Problem: to retrive report ask perameter value for entering date for main report and its subreports and when I print report it ask me again which realy bothers me lot. Also I would like to enter another criteria but it would crete more problem

    Now question: is there any way ithat i can  enter only one time Date for main report and that value pass on to subreport automatic whch make my life easy?

    Please help me on this. Thanks

    Atul

    Friday, March 29, 2013 9:51 PM

Answers

  • Hi AR_D,

    Actually, if I remembered it correctly, there are two ways you can accomplish that.

    First, is that the parameter in your main report will pass it on the sub-report by right clicking the sub-report. And on the Parameters tab, add a parameter by clicking the add button. You can automatically see on the drop down list the parameter name needed for the sub-report (if and only the sub-report you've selected has a parameter to be supplied). Please note that you can only see the parameters needed by the sub-report on the drop down list if you manually selected the sub-report from the toolbox. If you add the sub-report by dragging that report into the design area, then you have to manually type the parameter name.

    After you've selected the parameter name, select the value to be passed on the sub-report by selecting the value of the parameter of your main report. You can do this by typing

    = Parameters!<name of the parameter on the main report>.Value

    or, you can just click the parameter label on the bottom and then select the parameter you want to pass on the sub-report by double clicking it.



    Now you're set. After setting up the process above. On the sub-report (the RDL of the sub-report), you have to set the parameter of the date parameter to be hidden. This way, you don't have to ask the user to input for a value of that parameter. Remember, this parameter will receive the value from the main report automatically. Remember also that I've said there are two ways you can accomplish what you want.

    1.) On the dataset of the sub-report, right click it and select the filter tab. Add a new filter and select the date parameter as filter. This is how it looks like:

    date (This is just a sample name of the fields on your dataset that will filter the query)

    =

    Parameter!<name of the parameter>.Value


    2.) Just add the parameter on the WHERE clause of your query. Something like this:

    SELECT * from Table_Name where date_column = @parameter_name




    From what you've said, option 2 is best suited for you since you add the parameter on your query. I guess the only work left for you is to set the parameter on the sub-report to be hidden. Hope this helps.

    • Proposed as answer by Fanny Liu Monday, April 1, 2013 2:50 AM
    • Marked as answer by Fanny Liu Thursday, April 4, 2013 4:49 AM
    Saturday, March 30, 2013 4:50 AM

All replies

  • Hi,

    If I understood your problem , you want to have just one parameter and bind it to all dataset queries.

    If so,  Create a parameter (of date time) and then in the dataset --> Properties --> Parameters , use the above created parameter bind to your dataset parameter (it will appear on drop down).

    Do the same for all other datasets.

    Delete all other parameters.

    Hope this helps.

    - Girija

    Friday, March 29, 2013 10:01 PM
  • Hi Girija Shankar,

    Thanks for answer. You understood correct my Question. But how/where can i set Dataset? I checked in all reports property I couldn't find anywhere dataset property! But i already have this parameter set in Query for all reports.

    Atul

    Friday, March 29, 2013 10:47 PM
  • Hi AR_D,

    Actually, if I remembered it correctly, there are two ways you can accomplish that.

    First, is that the parameter in your main report will pass it on the sub-report by right clicking the sub-report. And on the Parameters tab, add a parameter by clicking the add button. You can automatically see on the drop down list the parameter name needed for the sub-report (if and only the sub-report you've selected has a parameter to be supplied). Please note that you can only see the parameters needed by the sub-report on the drop down list if you manually selected the sub-report from the toolbox. If you add the sub-report by dragging that report into the design area, then you have to manually type the parameter name.

    After you've selected the parameter name, select the value to be passed on the sub-report by selecting the value of the parameter of your main report. You can do this by typing

    = Parameters!<name of the parameter on the main report>.Value

    or, you can just click the parameter label on the bottom and then select the parameter you want to pass on the sub-report by double clicking it.



    Now you're set. After setting up the process above. On the sub-report (the RDL of the sub-report), you have to set the parameter of the date parameter to be hidden. This way, you don't have to ask the user to input for a value of that parameter. Remember, this parameter will receive the value from the main report automatically. Remember also that I've said there are two ways you can accomplish what you want.

    1.) On the dataset of the sub-report, right click it and select the filter tab. Add a new filter and select the date parameter as filter. This is how it looks like:

    date (This is just a sample name of the fields on your dataset that will filter the query)

    =

    Parameter!<name of the parameter>.Value


    2.) Just add the parameter on the WHERE clause of your query. Something like this:

    SELECT * from Table_Name where date_column = @parameter_name




    From what you've said, option 2 is best suited for you since you add the parameter on your query. I guess the only work left for you is to set the parameter on the sub-report to be hidden. Hope this helps.

    • Proposed as answer by Fanny Liu Monday, April 1, 2013 2:50 AM
    • Marked as answer by Fanny Liu Thursday, April 4, 2013 4:49 AM
    Saturday, March 30, 2013 4:50 AM