SSRS - what is the difference between Fields and Datasets, when building an expression

Viewed 17

I'm creating expressions in SSRS. What is the difference between selecting a field from "Fields" and selecting it from "Datasets"? They both look to contain all the same fields in my one dataset.

enter image description here

1 Answers

It's related to the context of the expression. The fields collection is those fields which are in the dataset your working with. In your case the "RouteSheetData" dataset as this will be bound to the tablix you are editing.

if you want to reference data from another dataset that is not bound to your current tablix, then you would go via the Datasets collection.

It's equivalent to the following expressions.

This first one is setting a textbox in a table that is bound to myMainDataSet, these two expressions will produce the same result

=SUM(Fields!Amount.Value)
=SUM(Fields!Amount.Value, "myMainDataSet")

If I have a text box that is not bound, the first one would not work as there is no bound dataset to use as a default but the 2nd expression would work.

Similarly, if I wanted to refence data from another dataset in my bound tablix above, then I can do that as long as I specify the dataset name I want to get the data from such as ...

=FIRST(Fields!EmployeeName.Value, "dsEmployees")

Hope that clears it up a little.

Related