0
votes

I've got two tables binded to two different datasets. I'm trying to reference one of the rows from one of the tables (Table A) from Table B.

Since it's outside the scope of the table, I can't use ReportItems![Textbox name].Value

Any ideas?

1
How do you envision referencing the matching row in the other table? I think you are better off by adding the field to your dataset, either in the query or by doing a lookup in a calculated field in SSRS. - cdonner

1 Answers

2
votes

You can use the SSRS Lookup() or LookupSet() function to retrieve the data directly from the other dataset.

I found the MSDN pages a bit unclear, the syntax goes like this:

=LOOKUP(Fields!sourceMatchingField.Value,
    Fields!targetMatchingField.Value,
    Fields!targetReturnField.Value,
    "Name of Second Dataset"
)
  • Fields!sourceMatchingField.Value is from the dataset that is currently in scope.

  • Fields!targetMatchingField.Value is from the other data set you need to get information from and equals Fields!sourceMatchingField.Value.

These two parameter values for the Lookup function make the join criteria for the two datasets. They can be more complicated than simply two field references (such as using functions to manipulate on or both), but I'm just showing the simplest way to do it.

  • Fields!targetReturnField.Value is the field from the second dataset that you want to return. This should just be a reference to a field.

  • "Name of Second Dataset" is just what you've named the other dataset that you're joining to.