Converts the specified Expression to the type specified in Emit, optionally using the specified Format String.


Properties

Expression

Type: Object Input
The Expression to be formatted

Format

Type: String Input
An optional Format string. The permissible values for the string depend on the Expression and Emit types.

Emit

Type: List Input
Boolean - Equivalent to System.Boolean in C#
DateTime - Equivalent to System.DateTime in C#
Double - Equivalent to System.Double in C#
String - Equivalent to System.String in C#
Integer - Equivalent to System.Int32 in C#
The data type to emit (ie. the type to which Expression will be converted)

Value

Type: Object Output
The converted value

Remarks

Use this Node to convert a value to a desired type before performing additional processing. Following conversion examples are:

  • Convert string to a date object

  • Convert a date to a string formatted in the specified way (eg. dd/MM/yyyy)

  • Convert a 1 or the text "True" to a boolean or vice-versa


The table below shows the behaviour of each of the conversion permutations:

Converting between String and DateTime

The C# method String.ParseExact is used to convert a String to a DateTime while DateTime.ToString is used for the reverse.

When converting a String to a DateTime, the Format Property must exactly match the format of the date specified as a string in Expression.

Note that the slash character is a special character and needs to be escaped with back-slash. For example, the date format yyyy/MM/dd  should be presented as yyyy\/MM\/dd. This is necessary because the slash character is used as an escape character and has other uses.

Examples

Did this answer your question?