Format Value

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
The data type to emit (ie. the type to which Expression will be converted)

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#

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 behavior 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.

Refer to the MSDN pages Standard Date and Time Format Strings and Custom Date and Time Format Strings for further information.

Examples

See Sample Workflow for examples.