Using Functions in Expressions

Using Functions in Expressions

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:

  1. {Trim(MyString)}

OR

  1. {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.

    • Related Articles

    • Understanding the Text Editor in Report Designer

      The Text Editor allows users to edit text components in Report Designer. This ability to modify text components allows for better customization of report appearances. Expression Tab Fig. 01 – Expression Tab (Text Editor) This tab has the following ...
    • Using Expressions in the Rich Text Editor of Report Designer

      The articles in this section of the Knowledge Base involve working with Rich Text for display in your reports. To learn more about the Rich Text editor, and how to access this section within the Report Designer, see An Introduction to the Rich Text ...
    • Using Aliases in Expressions

      Aliases can make it easier to understand expressions in reports. If you have a variable called “VariableA” and you have set an alias for it to “VA,” the variable can be referenced by Name OR Alias. By Name: {VariableA} By Alias: {[VA]} Syntax – ...
    • Multi Line Expressions

      Multiple lines of text can be produced in a report by a single expression. To create a multi-line expression, insert a line feed before any new line. To do this, press the Enter key at the appropriate place in the code editor. There is no limit to ...
    • Text Expressions

      Text expressions are the simplest expressions. Here are some examples: SampleText 54321 Example All of the expressions above are strings, and there are no calculations. These expressions would be printed as they have been defined. These types of ...
    • Recent Articles

    • Toolbox Release Notes | Build 25.1.1204.641

      The following release notes apply to Toolbox build 25.1.1204.641 Toolbox Login Screen Update Fig. 1: The updated Toolbox Login interface. The Toolbox Login interface has had several changes applied to it to enhance its usability and allow for greater ...
    • Toolbox Release Notes | Build 25.1.1120.641

      The following release notes apply to Toolbox build 25.1.1120.641 Mouse Wheel Fix There was a reported issue in certain interfaces (such as report groups) in which hovering over a dropdown menu (such as Output Type) would result in the options within ...
    • Dynamic Dimensioning in Toolbox BSB

      When applying dimensions to products and other solids in Toolbox BSB, by default, all dimensions are drawn in 2D on the Y plane, requiring one to switch to a top view (or an appropriately high isometric view) to see them. BricsCAD has a feature that ...
    • Toolbox Release Notes | Build 25.1.1107.641

      The following release notes apply to Toolbox build 25.1.1107.641. Subassembly Prompt Fixes A pair of issues were reportedly occurring when attempting to work with subassembly prompts in the Edit Design Data interface. Subassemblies copied to the ...
    • Microvellum Foundation Library Release Notes | Build 25.1024

      The following release notes apply to the Microvellum Foundation Library build 25.1024. Additions Added Face Profile Options to the Door Wizard for enhanced design flexibility. Users can now apply decorative visual profiles to doors, drawer fronts, ...