First Function (Report Builder 2.0)
Returns the first value in the given scope of the specified expression.
Syntax
First(expression, scope)
Parameters
expression
(Variant or Binary) The expression on which to perform the aggregation, for example, =Fields!FieldName.Value. The expression cannot contain aggregate functions.scope
(String) Optional. The name of a dataset, group, or data region that contains the report items to which to apply the aggregate function. If scope is not specified, the current scope is used. For more information, see Using Built-in Report and Aggregate Functions in Expressions (Report Builder 2.0) and Calculating Totals and Other Aggregates (Report Builder 2.0).
Return Type
Determined by the type of expression.
Remarks
The First function returns the first value in a set of data after all sorting and filtering have been applied at the specified scope.
The First function cannot be used in group filter expressions with anything except the current (default) scope.
You can also use First in a page header to return the first value from the ReportItems collection for a page in order to produce dictionary-style headings that display the first and last entries on a page.
The value of scope cannot be an expression and must refer to the current scope or a containing scope.
Example
The following code example returns the first product number in the Category group of a data region:
=First(Fields!ProductNumber.Value, "Category")