Expression

An expression is a sequence of one or more operands and zero or more operators that can be evaluated to a single value, object, method, or namespace. 

Screenshot

Supported Functions

Expressions can be combined using operators. Each operator has a precedence priority. Here is the list of a few expression's in its priority.

  1. Primary
  2. Unary
  3. Power
  4. Multiplicative
  5. Additive
  6. Relational
  7. Logical
NAME DESCRIPTION USAGE RESULT
Abs Returns the absolute value of a specified number. Abs(-1) 1M
Acos Returns the angle whose cosine is the specified number. Acos(1) 0d
Asin Returns the angle whose sine is the specified number. Asin(0) 0d
Atan Returns the angle whose tangent is the specified number. Atan(0) 0d
Ceiling Returns the smallest integer greater than or equal to the specified number. Ceiling(1.5) 2d
Cos Returns the cosine of the specified angle. Cos(0) 1d
Exp Returns e raised to the specified power. Exp(0) 1d
Floor Returns the largest integer less than or equal to the specified number. Floor(1.5) 1d
IEEERemainder Returns the remainder resulting from the division of a specified number by another specified number. IEEERemainder(3, 2) -1d
Log Returns the logarithm of a specified number. Log(1, 10) 0d
Log10 Returns the base 10 logarithm of a specified number. Log10(1) 0d
Max Returns the larger of two specified numbers. Max(1, 2) 2
Min Returns the smaller of two numbers. Min(1, 2) 1
Pow Returns a specified number raised to the specified power. Pow(3, 2) 9d
Round Rounds a value to the nearest integer or specified number of decimal places. The mid number behavior can be changed by using EvaluateOption.RoundAwayFromZero during construction of the Expression object. Round(3.222, 2) 3.22d
Sign Returns a value indicating the sign of a number. Sign(-10) -1
Sin Returns the sine of the specified angle. Sin(0) 0d
Sqrt Returns the square root of a specified number. Sqrt(4) 2d
Tan Returns the tangent of the specified angle. Tan(0) 0d
Truncate Calculates the integral part of a number. Truncate(1.7) 1

Ports

The Expression component exposes Control In, Control Out and Data Out ports by default.

Port Description
Control In Must be connected to the Control Out port of one or more components.
Control Out Must be connected to the Control In port of any other component.
Data In- Dynamic Must be connected to Data out port of another component from where the data is to be collected for the variable in the Expression component.This port is dynamically created with the name of the variable provided in the Expression component.
Data Out Must be connected to the Data In port of another component from where data is to be collected.Expression component can return any type of data such as Object, string or integers

Properties

To edit the properties of Expression component, in the Properties window, change the required property. Users can edit the following properties:

Property Description
Search Search for the respective property.
Delay After Execution Specifies the wait time (in seconds) after the action is executed.
Delay Before Execution Specifies the wait time (in seconds) before the action is executed.

Example

Let us consider an example.

Screenshot

To use the Expression component:

  1. In the Toolbox, expand the General.

  2. Drag the Expression component and drop it on the Design surface.

  3. Below the title bar of Expression component, enter the expression. For example, let's use the expression as (i/j) *k. Data In ports are dynamically created with the name of the variable provided in the Expression TextBox.

  4. Double-click on the dynamically created input and give the value.

  5. Expand the Message box, Drag the show component and drop it on the design surface.

  6. Connect:

    • The Control ports of all components.

    • The Data out ports of the Expression component to the Data In port of the Show component.

  7. In the toolbar, click Run.

    Screenshot