Search code examples
reporting-servicesssrs-2008ssrs-tablixssrs-2008-r2

Passing Parameters from Main Report to Sub Report


Here is an example of what my tablix/matrix looks like and some examples of what should happen. I have the parameters in the second report setup to accept values and in the main report I have just selected the field it should pass. Since it’s a matrix and grouped, I would think if you clicked a sub total row it would know what values relate to that row.

enter image description here

Following examples,which define what should happen:

1.When i click on cell B3(USA) it will pass Locations name i.e USA and Customer name i.e ABC as a parameter to sub report.

2).When i click on cell B5 i.e Sub total, it will send both locations i.e. USA,Dubai and customer name i.e.abc as a parameter to Sub Report.

3).When i click on cell B10 i.e Grand Total, it will send all Customer names with there respective locations as a parameters to the sub report.

Thank You


Solution

  • This is how I would do it. For the Subtotal link, pass "ALL" for the Location Parameter and =Fields!.Customer.Value for the Customer Parameter. For the Grand Total link, pass "ALL" for both Parameters. Then update your Sub-Report Query Where clause:

    Where
        (Customer = @Customer or @Customer = 'ALL')
        and (Location = @Location or @Location = 'ALL')
    

    This will return all Customer/Location records when the respective Parameters are set to 'ALL'.

    Let me know if you need any more detail.