Share via


Level Function ((Visual Studio Report Designer)

Returns the current level of depth in a recursive hierarchy.

Level(Scope)

Parameters

  • Scope
    (String) The name of a data table, object, grouping, or data region that contains the report items to which to apply the aggregate function. Scope is optional.

Return Type

Returns an Integer. If Scope specifies a data source or data region, or specifies a nonrecursive grouping (that is, a grouping with no Parent element), Level returns 0. If Scope is omitted, it returns the level of the current scope. For more information about the Scope parameter, see Built-in Functions for Reports (Visual Studio Report Designer).

Remarks

The value returned by the Level function is zero-based; that is, the first level in a hierarchy is 0.

The Level function can be used to provide indentation in a recursive hierarchy, such as an employee list. For more information about recursive hierarchies, see Grouping Data in a Report (Visual Studio Report Designer).

Example

The following code example provides the level of row in the Employees grouping.

Level("Employees")

See Also

Concepts

Using Expressions in a Report (Visual Studio Report Designer)
Adding Custom Code to a Report (Visual Studio Report Designer)
ReportViewer Controls (Visual Studio)
Built-in Functions for Reports (Visual Studio Report Designer)