Expressions

Float Expression Provides the possibility to write logical C# expressions with a Float as resulting output value.
Int Expression Provides the possibility to write logical C# expressions with an Int as resulting output value.
String Expression Provides the possibility to write logical C# expressions with a String as resulting output value.

Expressions Nodes can combine multiple input properties, perform numeric/string operations on the inputs and provide the result as an output property. They can be thought of as mini C# sharp functions and follow the C# syntax. The number of inputs can be adjusted by using the Custom Model.

A Float Expression with four input properties and the expression EXPRESSION is internally roughly translated to something like the following:

using System;

String expressionMethod(String A, String B, String C, String D)
{
   return EXPRESSION;
}

The expression must therefore be a single statement that evaluates to the target type. For example, it is not possible to use the if-keyword in an expression but an inline if

boolean_expression ? true_value : false_value

is valid. Since the System namespace has been made available, all functions in the  Math Namespace, the Convert Class and all  String operations are supported. The Expression Nodes have been designed for simple operations only. To avoid their limitations, use the Script Node instead.

Examples

A + B Sum of A and B for numeric expressions or the concatenation for string expressions.
(A + 1.0) * B Product of B and the sum of A and 1.
Math.Sin(A / 180.0 * Math.PI) Sine of the input degrees given in angle.
Math.Asin(A) * 180.0 / Math.PI) Inverse sine of the given value A, converted to degrees.
(A == 1.6) ? 1:0 Return 1 if A is equal to 1.6, otherwise return 0.
(A != B) ? 1:0 Return 1 if A is not equal to B, otherwise return 0.
(A < 0) ? 0 : A Return 0 if A is smaller than 0, otherwise return A.
(A >= 0) ? 0 : A Return 0 if A is greater than or equal to 0, otherwise return A.
(A < 10) ? 10: ( (A > 20) ? 20 : A) Returns A clamped into the the interval 10 to 20.
(double)(int)A Converts A into an integral value (all fractions are removed) and converts it back to double.
Convert.ToString( Convert.ToInt32(A) * Convert.ToInt32(B)) Convert the two input strings to integers, multiply them and convert the result back to a string
See also: