Using .NET Framework Functions in Formulas

A number of Microsoft .NET functions are also available for use in formulas.  In particular, all shared and static properties and functions from the String, Math, DateTime and Convert classes in the Microsoft .NET Framework are available.

The first argument is the type and the second argument is the prefix (or namespace) used to refer to the function.  For example, to get a string of all roles separated by commas, you can use the Join() static function on the String class:

= String.Join(“,”, Roles())

In addition to using the shared or static functions from the above classes, all non-shared functions can be used if the formula already uses an instance of the given data type.  For example, by calling the PARSEDATE function on a user interface control returns a DateTime object instance.  Non-shared DateTime functions can be called on this instance if required. For example,

= PARSEDATE(OrdersRecordControl.OrderDate.Text).AddDays(-10)

will return a date 10 days earlier than the value entered in the OrderDate textbox control.

String static function examples

= String.Empty
= String.Compare(“this”, “that”)
= String.Format(“This is a {0} idea.”, “GREAT”)

Reference: http://msdn.microsoft.com/en-us/library/system.string_members.aspx

DateTime static function examples

= DateTime.DaysInMonth(2010, 4)
= DateTime.IsLeapYear(2010)
= DateTime.MaxValue

Reference: http://msdn.microsoft.com/en-us/library/system.datetime_members.aspx

Convert static function examples

= Convert.ToDecimal(10)
= Convert.ToString(10)

Reference: http://msdn.microsoft.com/en-us/library/system.convert_members.aspx

Math static function examples:

= Math.Abs(-55)
= Math.Log(45)
= Math.Truncate(10.45)

Reference: http://msdn.microsoft.com/en-us/library/system.math_members.aspx

See Also

Variables Available in Formulas

Formula Evaluation Order

Indexing

Using Table and Record Control Functions in Formulas

Using .NET Framework Functions in Formulas

Using Custom Functions in Formulas

Formula Error Reporting