Standard and String Functions Reference (iLogic)

iLogic provides a set of String functions for text parameters that can be included in your iLogic rules.

To access the String functions, expand the Strings node under the System tab in the Snippets area of the iLogic Edit Rule dialog

Standard String functions

Most of the String functions used in iLogic are provided as part of the standard VB.NET String Library. They include:

Left() CStr()
Compare Now()
Len() DateString
Right() TimeString
Mid() Val(string)
LCase() Read All Text
UCase()  

Documentation for these functions is available at http://msdn.microsoft.com/en-us/library/system.string_methods(VS.80).aspx

iLogic String functions

Several String functions are specific to iLogic:

Function Purpose Examples
CDblAny(string) Convert a text string into a Double value. Like the standard VB.NET function CDbl. It converts a text string using either a comma or a period as a decimal separator, independent of your Windows language settings. It can fail if the text string does not represent a valid number.

x = CDblAny(“3.14159”) returns 3.14159

x = CDblAny(“3,14159”) returns 3.14159

RoundToFraction(value, fractionFactor, RoundingMethod.Round)

Format a numeric value as a text string, in fraction form to represent inch measurements.

Returns a fraction (for example, "1/2"), or a number and fraction (for example, "3 5/8"). Rounds the value to a multiple of the fraction factor.

fractionFactor must be 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, or 1/128.

RoundingMethod.Round rounds to the closest multiple of fractionFactor.

RoundToFraction(0.7502, 1/4, RoundingMethod.Round)' returns "1/4"

RoundToFraction(value, fractionFactor, RoundingMethod.RoundUp)

Format a numeric value as a text string, in fraction form to represent inch measurements.

Returns a fraction (for example, "1/2") or a number and fraction (for example, "3 5/8"). Rounds the value to a multiple of the fraction factor.

fractionFactor must be 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, or 1/128.

RoundingMethod.RoundUp rounds to the nearest multiple of fractionFactor, greater than or equal to the value.

RoundToFraction(0.7502, 1/4, RoundingMethod.RoundUp)' returns "3/4"

RoundToFraction(0.749, 1/4, RoundingMethod.RoundUp) ' returns "3/4"

RoundToFraction(0.749, 1/8, RoundingMethod.RoundUp)' returns "3/4"

RoundToFraction(0.7, 1/8, RoundingMethod.RoundUp) ' returns "3/4"

RoundToFraction(0.6, 1/4, RoundingMethod.RoundUp)' returns "3/4"

RoundToFraction(0.6, 1/8, RoundingMethod.RoundUp) ' returns "5/8"

RoundToFraction(value, fractionFactor, RoundingMethod.RoundDown)

Format a numeric value as a text string, in fraction form to represent inch measurements.

Returns a fraction (for example, "1/2") or a number and fraction (for example, "3 5/8"). Rounds the value to a multiple of the fraction factor.

fractionFactor must be 1/2, 1/4, 1/8, 1/16, 1/32, 1/64, or 1/128.

RoundingMethod.RoundDown rounds to the nearest multiple of fractionFactor, less than or equal to the value.

RoundToFraction(0.7502, 1/4, RoundingMethod.RoundDown) ' returns "3/4"

RoundToFraction(0.749, 1/4, RoundingMethod.RoundDown) ' returns "1/2"

FormatAsFraction(value, [numberOfDecimals])

Format a numeric value as a text string, in fraction form to represent inch measurements.

Returns a fraction (for example, "1/2"), or number and fraction (for example, "3 5/8"). Only if the value can be expressed as a whole-number fraction with a power-of-2 denominator (up to a maximum of 128, within 0.0000001). Otherwise it returns a decimal number.

If decimals are returned, the numberofDecimals argument affects the rounding of the resulting text string. This argument is optional, and defaults to 3 if it is not provided.

FormatAsFraction(0.75) ' returns "3/4"

FormatAsFraction(2.375)' returns "2 3/8"

FormatAsFraction(2.4) ' returns "2.4"

FormatAsFraction(2.00001) ' returns "2"

Note: You can use the CDblAny function to convert values of iLogic text parameters to numbers.