You are here: Transaction Rules > Transaction Elements > Math Element > FUNCTION

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

Element 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 Example

<MathVariable VARIABLENAME="NewDate" TYPE="FUNCTION" DATATYPE="DATE">ToDate(SystemDateMV, DayMV)</MathVariable>

 

Available Functions

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 ()

startDate : DATE,

endDate : DATE

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

INTEGER

CalendarMonthsDiffOf ()

startDate : DATE,

endDate : DATE

Computes the number of calendar months between two dates (endDate minus startDate). The result changes merely by the dates being in two different months. For example startDate = 1/28/2004 and endDate = 2/27/2004. Result is 1. startDate = 1/28/2004 and endDate = 2/28/2004. Result is 1. startDate = 1/28/2004 and endDate = 2/29/2004. Result is 1. startDate = 1/28/2004 and endDate = 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 ()

startDate : DATE,

endDate : DATE

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

INTEGER

DaysAdd ()

date : DATE,

days : INTEGER

Adds a number of days (INTEGER) 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 ()

startDate : DATE,

endDate : DATE

Computes the number of days between two dates. (endDate minus startDate). 

INTEGER

  DaysOf ()

value : DATE

Returns the day portion of the given date.

INTEGER

DurationOf ()

startDate : DATE,

endDate : DATE

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

INTEGER

FullMonthsDiffOf ()

startDate : DATE,

endDate : DATE

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

INTEGER

GivesBestDay ()

date : DATE,

bestDay : INTEGER

Computes a date having the same month and year as the given date and with the specified day (bestDay) 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, date = 2/15/2007 and bestDay = 30, result is 2/28/2007. date = 7/4/2010 and bestDay = 15, result is 7/15/2010.   

DATE

IsAlpha ()

value : TEXT

Returns true if the parameter has alphabetic characters only.

BOOLEAN

IsAlphaNumeric ()

value : TEXT

Returns true if the parameter has alphabetic or numeric characters.

BOOLEAN

IsEmpty ()

value : [DATE | OBJECT | TEXT]

Returns true if given parameter has not been initialized.  

BOOLEAN

IsNumeric ()

value : TEXT

Returns true if the parameter has numeric characters only.

BOOLEAN

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 ()

date : DATE,

months : INTEGER

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

DATE

MonthsDiffOf ()

startDate : DATE,

endDate : DATE

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

INTEGER

NextMultipleMode ()

date : DATE,

mode : INTEGER,

number : INTEGER

Returns a date that is a number of modal units from the given date. mode 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

PolMonthOf ()

referenceDate : DATE,

pointInTime : DATE

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

INTEGER

Present Value ()

rate : DECIMAL,

periods : INTEGER,

payment : DECIMAL,

futureValue : DECIMAL,

type : DECIMAL

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

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

- periods is the total number of payment periods.  

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

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

- type indicates the timing of payments within the periods.

 

Value 0 = Payment due at the end of the period.

Value 1 = Payment due at the beginning of the period.

DECIMAL

QuartersAdd ()

date : DATE,

number : DECIMAL should be INTEGER

Adds a number (INTEGER) of quarters (three months) to a date (DATE).

DATE

ReplaceDayOfMonth ()

date : DATE,

day : INTEGER

Replaces the day portion of a date (DATE) with day.

DATE

ReplaceMonth ()

date : DATE,

month : INTEGER

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

DATE

ReplaceYear ()

date : DATE,

year : INTEGER

Replaces the year portion of a date. Four- digit year must be used. 

DATE

TableMult ()

tableRating : TEXT

Returns the rate multiplier for a given table rating code (TEXT). 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

ToDate ()

value : [DATE | OBJECT | TEXT]

Returns the given value as a date.  

DATE

ToDecimal ()

value : [DECIMAL | INTEGER | OBJECT | TEXT]

Converts the given value to a DECIMAL value.  

DECIMAL

ToInteger ()

value : [DECIMAL | INTEGER | OBJECT | TEXT]

Converts the given value to an INTEGER value.  

INTEGER

  ToText ()

value : [DECIMAL | INTEGER | OBJECT | TEXT]

Converts the given value to a TEXT value.  

TEXT

  TruncateNumber ()

number : DECIMAL,

decimalPlaces : INTEGER

Truncates the number (DECIMAL) to a given number of decimal places (INTEGER). When decimalPlaces 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

YearsDiffOf ()

startDate : DATE,

endDate : DATE

Computes the number of years between two dates (endDate minus startDate). 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, startDate = 11/15/2010, endDate = 1/20/2011, return value is 1. startDate = 11/15/2010, endDate = 7/4/2014, return value is 4.    

INTEGER

 

Copyright © 2009, 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices