Skip to main content

Using Functions in Expressions

J
Written by Jordan Munoz

Built-in Functions

There is a variety of built-in functions available in the Report Designer. These functions can be accessed directly from the data dictionary, or from within the Expression Editor. Here is an example of a built-in function: {Trim(MyString)} or {Trim(MyDataSource, MyDataColumn)}.

The use of the Trim function in the above examples removes leading and trailing spaces from the result in the report.

.NET Framework Methods

Beyond the built-in functions, you can use any available .Net Framework methods. The following examples apply to string expressions:

  1. {MyString.Trim()} – This eliminates leading and trailing spaces.

  2. {“Test”.ToUpper()} – This converts the characters in the value to upper case “EXAMPLE.”

  3. {MyString.Length} – This returns the length of the string. If the value of “MyString” is “Example,” the method would return 7.

The following examples apply to numerical expressions:

  1. {Math.Round(MyValue, 2)} – This rounds the number to two decimal places.

  2. {Math.Sqrt(MyValue)} – This returns the square root of “MyValue.”

  3. {MyValue.ToString() + “times.”} – This converts the number to a string, and adds the word “times.” When “MyValue” is 8, this returns “8 times.”

If methods are available in .NET for the type you are using in a report, you can use them without restriction.

Did this answer your question?