FUNCTION

Description

This math element calls a pre-defined function and returns a value.  The available pre-defined functions are listed below.

FUNCTION Element/Attribute Table
TYPE = FUNCTION    

Element

Attributes

Attribute Value

<MathVariable>

 

TYPE

FUNCTION

Call to a function in the form of: FunctionName(Parameters).

DATATYPE

Needs to match the data type of the return value.

 

XML Examples

<MathVariable VARIABLENAME="NewDate"TYPE="FUNCTION" DATATYPE="DATE">ToDate(SystemDateMV,DayMV)</MathVariable>
<MathVariable VARIABLENAME="InputStringLength" TYPE="FUNCTION" DATATYPE="INTEGER">StringLength('Quick brown fox')</MathVariable>
<MathVariable VARIABLENAME="ConcatenateFunction" TYPE="FUNCTION" DATATYPE="BIGTEXT">Concatenate('Quick brown ','fox')</MathVariable>
<MathVariable VARIABLENAME="ReturnLeft" TYPE="FUNCTION" DATATYPE="BIGTEXT">Left('Quick brown fox',5)</MathVariable>
<MathVariable VARIABLENAME="RemoveLeft" TYPE="FUNCTION" DATATYPE="BIGTEXT">RemoveLeft('Quick brown fox',6)</MathVariable>
<MathVariable VARIABLENAME="PadLeft" TYPE="FUNCTION" DATATYPE="BIGTEXT">PadLeft('12345','B',10)</MathVariable>
<MathVariable VARIABLENAME="ReturnRight" TYPE="FUNCTION" DATATYPE="BIGTEXT">Right('Quick brown fox',3)</MathVariable>
<MathVariable VARIABLENAME="RemoveRight" TYPE="FUNCTION" DATATYPE="BIGTEXT">RemoveRight('Quick brown fox',10)</MathVariable>
<MathVariable VARIABLENAME="PadRight" TYPE="FUNCTION" DATATYPE="BIGTEXT">PadRight('12345','A',10)</MathVariable>
<MathVariable VARIABLENAME="IndexOfSubstring" TYPE="FUNCTION" DATATYPE="INTEGER">IndexOf('Quick brown fox','brown')</MathVariable>
<MathVariable VARIABLENAME="TextBodySubstring" TYPE="FUNCTION" DATATYPE="BIGTEXT">Substring('Quick brown fox',6,10)</MathVariable>
<MathVariable VARIABLENAME="BigTextMath" TYPE="VALUE" DATATYPE="BIGTEXT">My String</MathVariable>
<MathVariable VARIABLENAME="ConcatenateExpression" TYPE="EXPRESSION" DATATYPE="BIGTEXT">BigTextMath + ‘ is big’</MathVariable>
 

Available Functions

Unless specifically addressed below, functions cannot accept null values as parameters.

Signature

Parameters

Description

Return Value

AbsOf()   

value: [DECIMAL | INTEGER]

Returns the absolute value of the given value. The return value is of the same data type as the parameter. 

DECIMAL / INTEGER

ANBAgeOf ()

value1: DATE

value2: DATE

Computes the age in years given two dates (value2 minus value1). The calculation is based on moving value2 to the nearest anniversary of value1 and then calculating the age. For example, value1 = 3/15/1972 and value2 = 12/20/1981 then the result is 10, since value2 is closer to 3/15/1982 than it is to 3/15/1981.  

INTEGER

CalendarMonthsDiffOf()

value1: DATE

value2: DATE

Computes the number of calendar months between two dates (value2 minus value1). The result changes merely by the dates being in two different months. For example value1 = 1/28/2004 and value2 = 2/27/2004. Result is 1. Value1 = 1/28/2004 and value2 = 2/28/2004. Result is 1. Value1 = 1/28/2004 and value2 = 2/29/2004. Result is 1. Value1 = 1/28/2004 and value2 = 3/1/2004. Result is 2.           

INTEGER

CalendarQuarter()

value: DATE

Returns the next calendar quarter end date that follows the given date. For example, any input date prior to on equal to 3/31/2010 results in 3/31/2010. 

DATE

CalendarYearsDiffOf ()

value1: DATE

value2: DATE

Computes the number of years between two dates (value2 minus value1). When value2 reaches the calendar month in which an anniversary occurs, the result is incremented. For example, value1 = 2/29/2004 and value2 = 1/31/2005, result is 0. Value1 = 2/29/2004 and value2 = 2/1/2005, result is 1: the month in which the first anniversary occurs has been reached.     

INTEGER

Concatenate()

value1 : [TEXT | BIGTEXT]

value2 : [TEXT | BIGTEXT]

Returns a Big Text value. The function will append the second string (value2) to the end of the first (value1). If input string is null, then the function will concatenate an empty string in that location. BIG TEXT

DaysAdd()

value1: DATE

value2: INTEGER

Adds a number of days (value2) to a date. The resulting date is adjusted by the calendar. For example 1 day added to 2/28/2003 is 3/1/2003 whereas 1 day added to 2/28/2004 is 2/29/2004.  

DATE

DaysDiffOf()

value1 : DATE

value2 : DATE

Computes the number of days between two dates. (value2 minus value1). 

INTEGER

DaysOf()

value : DATE

Returns the day portion of the given date.

INTEGER

DurationOf()

value1: DATE

value2: DATE

Computes the number of full years between two dates (value2 minus value1) with the number of years unchanged until an anniversary of value1 is reached or exceeded by value2. For example value1 = 2/29/2004 and value2 = 2/27/2005, result is 0. value1 = 2/29/2004 and value2 = 2/28/2005, result is 1.  

INTEGER

FullMonthsDiffOf()

value1: DATE

value2: DATE

Computes the number of full calendar months between two dates (value2 minus value1). The result does not change merely by the dates being in two different months. It actually changes when a monthaversary of value1 is matched or exceeded by value2. For example value1 = 1/28/2004 and value2 = 2/27/2004. Result is 0. value1 = 1/28/2004 and value2 = 2/28/2004. Result is 1. value1 = 1/28/2004 and value2 = 2/29/2004. Result is 1. value1 = 1/28/2004 and value2 = 3/1/2004. Result is 1. value1 = 1/30/2004 and value2 = 2/29/2004. Result is 0. value1 = 1/30/2004 and value2 = 3/1/2004. Result = 1.              

INTEGER

GetBenefitSplit()

SegmentGUID: TEXT

EffectiveDate: DATE

BenefitSplitTypeCode: TEXT

ABLIndicator: TEXT

ExcludeFunds: Stringarray, TEXT

BenefitAmount: CURRENCY

ParentFundAmountCollection: COLLECTION

SegmentGUID - a math variable holding the related segment for the BenefitSplit record.

EffectiveDate - a math variable holding the valuation effective date for AsNetAssetValue records.

BenefitSplitTypeCode - a math variable or literal value indicating the BenefitSplit type code to retrieve.

ABLIndicator - a math variable holding either Yes or No, indicates if ABL is in effect and variable benefit is to be suppressed.

ExcludeFunds - a math variable holding an array of one or more benefit funds to exclude from the calculated output.

For the specified Segment and Benefit Split Type code, this function will:

  • Return the Parent Fund GUID for the specified AsBenefitSplit Fund GUID. This will be the key part of the output collection. If the fund does not exist on the AsFundGroup table, returns the AsBenefitSplit Fund GUID.
  • Return the Fund amount where the AsBenefitSplit Units are multiplied by the AsNetAssetValue Unit Value as of the specified Valuation effective date . This will be the value part of the output collection. If the ABLIndicator is set to “Yes”, set all Variable (type 02) fund amounts to zero (0). If the fund is Fixed (type 03) return the Benefit amount directly from AsBenefitSplit.
  • Return the sum of all calculated benefit amounts (BenefitAmount output parameter).

Output:

BenefitAmount - gross Benefit amount in Plan default currency.

ParentFundAmountCollection - key/value pairs of Parent Fund GUID and Benefit Allocation Amounts in decimal values (Highest level parent to the benefit fund).

GetCurrencyCode() value: [MONEY | CURRENCY] Value should be a field with a datatype of "Money" or a math variable that has a datatype of "Currency." If a value is entered that is not a Money or Currency datatype, an empty string will be returned. String

GivesBestDay()

value1: DATE

value2: INTEGER

Computes a date having the same month and year as the given date (value1) and with the specified day (value2) of the month. If the specified day causes the new date to roll over into the next month, the day is decreased to the last day of the month. For example, value1 = 2/15/2007 and value2 = 30, result is 2/28/2007. value1 = 7/4/2010 and value2 = 15, result is 7/15/2010.   

DATE

IndexOf()

value1: [TEXT | BIGTEXT]

value2: [TEXT | BIGTEXT]

Returns an integer value. The function will return the positional index of the first character of the search string (value2) within an input string (value1). Positions are relative with the first position being 1. The strings are both case sensitive. The input string cannot be null. Input string cannot be empty if the integer is greater than 0. Negative integers are not supported. If the integer is 0, then the function will return an empty string. BIG TEXT

IsAlpha()

value: [TEXT | BIGTEXT]

Returns true if the parameter has alphabetic characters only.

BOOLEAN

IsAlphaNumeric()

value : [TEXT | BIGTEXT]

Returns true if the parameter has alphabetic or numeric characters.

BOOLEAN

IsCurrency() value: Any Returns true if the parameter is money or currency datatype. BOOLEAN
IsDate() value : Any Returns true if the parameter is date datatype. BOOLEAN

IsEmpty()

value : [DATE | OBJECT | TEXT | BIGTEXT]

Returns true if given parameter has not been initialized or is null.

BOOLEAN

IsLeapYearByYear() value: INTEGER Returns "1" if the year entered is a leap year, returns "0" if the year entered is not a leap year. INTEGER

IsNumeric()

value: [TEXT | BIGTEXT]

Returns true if the parameter has numeric characters only.

BOOLEAN

Left ()

value1: [TEXT | BIGTEXT]

value2: INTEGER

Returns a Big Text value. The function will return the specified number of characters from the left end of the input string based on the integer value (value2). The input string (value1) cannot be null. Input string cannot be empty if the integer is greater than 0. Negative integers are not supported. If the integer is 0, then the function will return an empty string. BIG TEXT

MaxDateOf()

value1 : DATE

value2 : DATE

Returns the greater of two dates.

DATE

MaxOf()

value1 : [DECIMAL | INTEGER]

value2 : [DECIMAL | INTEGER]

Returns the larger of two numbers. When any one of the parameter data types is DECIMAL, the return is DECIMAL. When both parameter data types are INTEGER, the return is INTEGER.  

DECIMAL / INTEGER

MinDateOf()

value1 : DATE

value2 : DATE

Returns the lesser of two dates.

DATE

MinOf()

value1 : [DECIMAL | INTEGER],

value2 : [DECIMAL | INTEGER]

Returns the lesser of two numbers. Like MaxOf(), when any one of the parameter data types is a DECIMAL, the return is DECIMAL. When both parameter data types are INTEGERs, the return is INTEGER.   

DECIMAL / INTEGER

MonthOf()

value : DATE

Returns the month portion of the given date.

INTEGER

MonthsAdd()

value1: DATE

value2: INTEGER

Adds a number of months (value2) to a date (value1). The resulting date is adjusted by the calendar. For example, 1 month added to 1/31/2004 is 2/29/2004.  

DATE

MonthsDiffOf()

value1: DATE

value2: DATE

Computes the number of months between two dates (value2 minus value1). It is the simple difference between the months of the two dates. For example, value1 = 2/28/2004 and value2 = 3/1/2004, result is 1. value1 = 2/28/2004 and value2 = 3/31/2004, result is 1. value1 = 2/28/2004 and value2 = 4/1/2004, result is 2.     

INTEGER

NextMultipleMode()

value1: DATE

value2: INTEGER

value3: INTEGER

Returns a date that is a number of modal units (value3) from the given date (value1). Value2 is a code value that identifies the mode. 

 

Code Value 1: Mode = Year 

Code Value 2: Mode = Half Year 

Code Value 4: Mode = Quarter 

Code Value 12: Mode = Month 

Code Value 24: Mode = Bi-week (every 15 days) 

Code Value 52: Mode = Week 

 

Note: Number is the number of modal units. 

DATE

PadLeft()

value1: [TEXT, BIGTEXT]

value2: TEXT

value3: INTEGER

Returns a Big Text value. The function will return the original input string (value1) with the pad character (value2) repeated on the left of the input string so that the total length of the new string is equal to the number of characters specified in value3. The input string cannot be null. Input string cannot be empty if the integer is greater than 0. Negative integers are not supported. If the integer is 0, then the function will return an empty string. BIG TEXT
PadRight()

value1: [TEXT, BIGTEXT]

value2: TEXT

value3: INTEGER

Returns a Big Text value. The function will return the original input string (value1) with the pad character (value2) repeated on the right of the input string so that the total length of the new string is equal to the number of characters specified in value3. The input string cannot be null. Input string cannot be empty if the integer is greater than 0. Negative integers are not supported. If the integer is 0, then the function will return an empty string. BIG TEXT

PolMonthOf()

value1: DATE

value2: DATE

Computes the number of months at a specified point in time (value2) since the last anniversary based on value1. For example, value1 = 6/7/2008, value2 = 7/1/2008, return value is 2 and is 2 for every value of value2 that is within July. Return value changes to 3 for every value of value2 that is within August, etc. Value1 = 6/7/2008, value2 = 1//2010, return value is 8 (the 8th month from the last anniversary of value1).   

INTEGER

PresentValue()

value1: DECIMAL

value2: INTEGER

value3: DECIMAL

value4: DECIMAL

value5: DECIMAL

Calculates the present value of an investment. The present value is the total amount that a series of future payments is worth now.

- Value1 is the interest rate per period and must be expressed as a percentage. If the periods are monthly, divide the annual interest rate by 12. If the periods are quarterly, divide the annual interest rate by 4, etc.  

- Value2 is the total number of payment periods.  

- Value3 is the payment made each period and cannot change over the live of the annuity.

- Value4 is the future value or the cash balance you want to attain after the last payment is made.

- Value5 indicates the timing of payments within the periods. Value5 = 0 means the payment is due at the end of the period. Value5 = 1 means the payment is due at the beginning of the period.

DECIMAL

QuartersAdd()

value1: DATE

value2: INTEGER

Adds a number (value2) of quarters (three months) to a date (value1).

DATE

RemoveLeft()

value1: [TEXT, BIGTEXT]

value2: INTEGER

Returns a Big Text value. The function will return the original input string (value1) less the specified number of characters (value2) from the left end of the input string based on the integer value. The input string cannot be null. Input string cannot be empty if the integer is greater than 0. Negative integers are not supported. If the integer is 0, then the function will return an empty string. BIG TEXT
RemoveRight()

value1: [TEXT, BIGTEXT]

value2: INTEGER

Returns a Big Text value. The function will return the original input string (value1) less the specified number of characters(value2) from the right end of the input string based on the integer value. The input string cannot be null. Input string cannot be empty if the integer is greater than 0. Negative integers are not supported. If the integer is 0, then the function will return an empty string. BIG TEXT

ReplaceDayOfMonth()

value1: DATE

value2: INTEGER

Replaces the day portion of a date (value1) with a specified day of the month (value2).

DATE

ReplaceMonth()

value1: DATE

value2: INTEGER

Replaces the month portion of a date (value1) with the specified month (value2). January’s integer value is 0 and December’s integer value is 11. 

DATE

ReplaceYear()

value1: DATE

value2: INTEGER

Replaces the year portion of a date (value1) with the specified year (value2). A four- digit year must be used. 

DATE

Right ()

value1: [TEXT, BIGTEXT]

value2: INTEGER

Returns a Big Text value. The function will return the specified number of characters (value2) from the right end of the input string (value1). The input string cannot be null. Input string cannot be empty if the integer is greater than 0. Negative integers are not supported. If the integer is 0, then the function will return an empty string. BIG TEXT

StringLength()

text : [TEXT, BIGTEXT]

Returns a positive integer indicating the number of Unicode characters contained in the input parameter. If the input string is null or 0, the function will return 0.

INTEGER

Substring()

value1: [TEXT, BIGTEXT]

value2: INTEGER

value3: INTEGER

Returns a Big Text value. The function will return a substring from the input string (value1) based on two positional indexes as defined by value2 and value3. The first and second integer reference the start and end index points respectively. The input string cannot be null. Input string cannot be empty if the integer is greater than 0. Negative integers are not supported. If both integers are 0, then the function will return an empty string. The first integer cannot be greater than the second and it cannot be greater than the input string length. If the second integer is greater than the input string length, then the function will use the length of the input string as the end index. BIG TEXT

TableMult()

value: TEXT

Returns the rate multiplier for the given table rating code entered as the value. The table rating codes that may be passed and their resulting multipliers are: 

 

Table Rating Multiplier         

01 1                            

02 1.25                            

03 1.35                            

04 1.5                            

05 1.675                            

06 1.75                            

07 2                            

08 2.25                            

09 2.5                            

10 2.75                            

11 3                            

12 3.25                            

13 3.5                            

14 3.75                            

15 4                            

16 4.25                            

17 4.5                            

18 4.75                            

19 5                            

 

DECIMAL

ToCurrency()

value 1: [DECIMAL | INTEGER]

value 2: STRING

Values should be a numeric value and a currency code. Returns the amount passed in as value 1 as the currency code entered as value 2. CURRENCY

ToDate()

value : [DATE | OBJECT | TEXT | BIGTEXT]

Returns the given value as a date.  

DATE

ToDateArray() value: OBJECT

Casts input object to date array.

If input is null, returns NULL. If input is an instance of a date array, returns the object cast to an integer array. If the input is neither of the above, returns an error.

DATEARRAY
ToDecimalArray() value: OBJECT

Casts input object to decimal array. Returned value is of type NUMERICARRAY and datatype DECIMALARRAY.

If input is null, returns NULL. If input is an instance of a decimal array, returns the object cast to an integer array. If the input is neither of the above, returns an error.

NUMERICARRAY

ToDecimal()

value : [DECIMAL | INTEGER | OBJECT | TEXT | BIGTEXT]

Converts the given value to a DECIMAL value.

DECIMAL

ToInteger()

value : [DECIMAL | INTEGER | OBJECT | TEXT | BIGTEXT]

Converts the given value to an INTEGER value.  

If input is null, returns NULL. If input is an instance of an integer array, returns the object cast to an integer array. If the input is neither of the above, returns an error.

INTEGER

ToIntegerArray() value: OBJECT

Casts input object to integer array. Returned value is of type NUMERICARRAY and datatype INTEGERARRAY.

If input is null, returns NULL. If input is an instance of an integer array, returns the object cast to an integer array. If the input is neither of the above, returns an error.

NUMERICARRAY

ToText()

value : [DECIMAL | INTEGER | OBJECT | TEXT | BIGTEXT]

Converts the given value to a TEXT value.  

TEXT

ToTextArray() value: OBJECT

Casts input object to string array. Returned value is of type/datatype STRINGARRAY

If input is null, returns NULL. If input is an instance of a text array, returns the object cast to an integer array. If the input is neither of the above, returns an error.

STRINGARRAY

TruncateNumber()

value1: DECIMAL

value2: INTEGER

Truncates the number (value1) to a given number of decimal places (value2). When value2 is 0, a decimal is returned that holds an integer value. 

DECIMAL

YearBeginOf()

value: DATE

Returns the first day of the year for the given date. For example, Date = 3/11/2010, return is 1//2010. 

DATE

YearEndOf() value: DATE

Returns "12/31/n," where n is the year of the date entered as input.

If the date entered as input is null, throws an exception.

DATE
YearOf() value: DATE

Returns the year of the date entered as input.

If the date entered as input is null, throws an exception.

INTEGER
YearsAdd()

value1: OBJECT

value2: INTEGER

Casts the object entered as value 1 as a date and adds or subtracts the number of years entered as value2 from value1.

If the object is null, returns NULL. If the object is a timestamp, date or string, casts the value as a date. If the object is not one of the datatypes above, throws an error.

DATE

YearsDiffOf()

value1: DATE

value2: DATE

Computes the number of years between two dates (value2 minus value1). This computation does not increment the result based on anniversaries. The calculation is a simple difference between the year portions of the two dates. For example, value1 = 11/15/2010, value2 = 1/20/2011, return value is 1. value1 = 11/15/2010, value2 = 7/4/2014, return value is 4.    

INTEGER