Search code examples
sqlstored-proceduresreporting-servicesssrs-2008field

SSRS Putting field from executed Dataset as Parameter to Second Dataset


My issue is when executing a stored procedure in a DataSet (exec pStoredProcedure) and SSRS populates different Fields for me to use. I wish to make an additional query to one of these fields. DataSet 1 is:

exec pInfos @SessionGUID=@SessionGUID 

Dataset 2 is simply:

select * from myTable where infoHeader is @HeaderInfo

In this query, @HeaderInfo is my dataField from the first DataSet that is returned. Note that the tablix is expanding for the number of @HeaderInfo there happens to be.

What's a simple way to put this field in as the parameter and put the result onto a tablix? (note the tablix data source is dataset1).


Solution

  • Special thanks to TMNT2014 for his comment!

    I found two answers to my own question:

    The first is to use Lookup, in which I did

        select * from myTable
    

    I then did a Lookup as:

        =Lookup(Field!Headerinfo, Field!infoHeader, Field!ResultValue, "myTable")
    

    And the value is as I needed it. I also found that by navigating to parameters and adding your own, you can specify the default Values of that parameter (in parameter settings) and then select the Dataset -> Value Field. Although I didn't test this one, I thought I'd include it.