In most of the report item properties you can enter Microsoft Visual Basic® .NET expressions directly in the property grid or build expressions in the expression editor smart panel. You can use expressions to set the value of a report item, or to set conditions under which certain styles apply.
![]() |
Note: All expressions must begin with an equal sign (=). |
Even setting a basic field value for a text box is done using a simple expression:
=Fields!LastName.Value
Expressions are also used to aggregate data in summary fields. For more information, see Functions.
Using the Expression Editor
You can build many expressions much more quickly using the expression editor because it allows you to choose from a number of fields available to the report as well as to the particular property. Once you have chosen a field, you can replace the existing expression, insert the field into the expression at the cursor, or add the field onto the end of the expression. There are five types of fields available in the expression editor:
- Constants
- Constant fields are only available to properties which have enumerated values, such as TextDecoration or BorderStyle.
- Globals
- Global variables are run time values available to every property in every report. There are two variables in this list which come from the User collection: UserID and Language.
- Parameters
- Parameter fields are only available in reports which have report parameters. If available, you can choose a parameter from this field to retrieve the current value of the parameter.
- Fields
- If the report item is linked to a dataset, all of the fields in the dataset are available.
- Datasets
- All of the fields in each dataset in the report are available, but the report will retrieve only the sum or the first value of any field that is not within the current dataset scope.
- Operations
- More information will be added about this item prior to release.
- Common Functions
- More information will be added about this item prior to release.
Concatenating Fields and Strings
In its raw form, your data may not be ideally suited for display in a report. You can massage it into shape using expressions. You can concatenate fields with strings and with other fields. Here are a couple of examples followed by the results they yield:
=Fields!LastName.Value + ", " + Fields!FirstName.Value
Smith, Jane
=Fields!City.Value + ", " + Fields!Region.Value + " " + Fields!PostalCode.Value
Columbus, OH 43231
Conditional Formatting
You can highlight report items based on specific field values by using expressions in properties like Color, BackgroundColor, Font, and Border.
The basic formula for conditional formatting is:
You can also use a conditional expression to decide whether to hide a textbox. For example, if you put the following expression in the Visibility > Hidden property of a textbox that displays the text "Free Shipping," the textbox only shows up on invoices sent to Denmark:
=iif( Fields!ShipCountry.Value = "Denmark", False, True)
For more examples see Conditional Formatting.
Functions
You can use any of a number of aggregate and other functions in your expressions. Although the summary function is the most common, Data Dynamics Reports includes a range of others, including running functions, standard variance, population standard deviation, count, minimum and maximum. For more information, see Functions.
Displaying Expressions at Design Time
Because the full text of an expression can be very long, Data Dynamics Reports tries to make simple expressions easier to read as you are designing your report. When an expression is in the form of:
=Fields!<FieldName>.Value
On the design surface, you will see this text inside that TextBox instead:
=[<FieldName>]
This works with aggregates as well. When the Expression value is this:
=<Aggregate>(Fields!<FieldName>.Value)
What will display instead is this:
=<Aggregate>([<FieldName>])
This shortening of the expression value is only a visual change to allow you to see the field name easier. It will show up in both the TextBox itself on the design surface as well as any dropdown boxes inside the Smart Panels. Any expressions that use Scope will not be subject to this shortening; they will still display the full expression.
![]() |
Note: You can also use this same format to type in these same types of expressions above. Simply type the format it lists above for either field name values or aggregates on field names and the full expression will still be evaluated when the report is viewed. |
