Data Dynamics Reports Online Help
Global Collections
See Also Support Forum
User Guide > Creating Reports > Building Reports > Expressions > Global Collections

Glossary Item Box

Data Dynamics Reports offers five Global Collections for use in expressions:

You can access any of the global collections using Microsoft Visual Basic® .NET collection syntax, for example:

Collection!ObjectName
= User!Language
Collection.Item("ObjectName")
= User.Item("Language")
Collection("ObjectName")
= User("Language")

The Globals, Parameters, and User global collections also support Visual Basic® .NET property syntax, for example:

Collection.ObjectName
= Globals.PageNumber

The Globals and User collection members are of the data type variant. If you need to use a specific data type, use casting. For example,

CDate(Globals!ExecutionTime)

Here are the five collections, and their uses:

Globals

There are nine global variables available for use in expressions:

Note: Page N of M and Page N of M (Section) are not distinct expressions themselves but are rather constructed from other expressions. They can be chosen using the Expression Editor or the Field Selection Adorner in a Textbox control located in the Page Header or Page Footer of a report.

Example:

= Globals!ReportName

Parameters

All Report Parameters are available for use with queries, filters, and expressions. There are two properties on the Parameter object: 

  • Value - returns the current value of the parameter.
  • Label - returns the more user-friendly version of the Value. For example, if the Value is the AirportCode, the Label might be the AirportName. If you did not specify a Label in the Parameter, the Value is used.

      In a report item property, you can check the current Value of a parameter to decide whether to change a background color or hide a textbox. The following example, when used in the BackgroundColor property, makes the Bevarages report AliceBlue, but leaves reports on all other categories Transparent.

      Example:

      =iif( Parameters!CategoryID.Label = "Beverages", "AliceBlue", "Transparent")

      Fields

      Each dataset in your report contributes a Fields collection. All fields in these collections are available for use in expressions. There are two basic properties on the Fields object:

      • Value - returns the current value of the field. If the same field name exists in multiple collections, the report looks to context to determine which collection to use. In a data region, it uses the associated dataset. In an aggregate expression, it uses the dataset for the scope.
      • IsMissing - indicates whether the field is present in the dataset.
      Note: Some data providers allow additional properties which you can access using the collection syntax.

      Example:

      = Fields!LastName.Value + ", " + Fields!FirstName.Value

      ReportItems

      Every report item in your report is available for use in expressions. There is one property on the ReportItems object:

      • Value

      Example:

      = ReportItems!textbox1.Value

      User

      There are two user variables available for use in expressions:

    • UserID - gets the machine name and user name of the current user.
    • Language - gets the language settings of the current user.

      You could use the UserID to retrieve user preferences or to grant or deny access to certain data. The Language can be used to determine time and date or currency formats. Unless you also have a conversion process in place though, it is best not to use the Language to determine currency formats so that you never end up with an invoice that should charge $5 but actually charges ¥5 (about four and a half cents).

      Example:

      = iif (User!Language = "en-US", "My fellow American", "Dear Madam or Sir")
    • See Also

      ©2010. GrapeCity, inc. All Rights Reserved.