Formulas Predefined by the Platform
A number of formulas are predefined by the platform. They are System Formulas.
Predefined Formula | Description |
---|---|
abs(number) | Returns the absolute value of the number specified. |
AddDay(timeInMillis,days) |
Adds the number of days specified to the date, date and time, or time specified and returns the result in milliseconds. The system is leap year aware. If you add 365 days to a leap year you will get a different result than if you add 365 days to a non-leap year. |
AddMonth(timeInMillis,months) | Adds the number of months specified to the date, date and time, or time specified and returns the result in milliseconds. |
AddYear(timeInMillis,years) | Adds the number of years specified to the date, date and time, or time specified and returns the result in milliseconds. |
applyRruleToEventUi(rRule,eventUiRecordid) | Applies a certain rule to a UI event for the specified record ID. |
createQueryEndDateFromEvent(eventRecordId) | Creates a query to extract the end date from an event related to a certain record ID. |
createQueryStartDateFromEvent(eventRecordId) | Creates a query to extract the start date from an event related to a certain record ID. |
createRecurrenceExDate(contextRecordId,associationName,dateTimeFieldName) | Creates a query to determine the recurring execution date given the original date and time field, the context record ID and the association name. |
createRelativeDateTime(inputDateTime,inputTimeZoneName) | Creates a query to determine the relative date and time given the original date and time and the specified time zone. |
CurrentTime() | Returns the current time of the Application Server as the number of milliseconds since midnight, January 1, 1970 UTC. |
DateFromDateTime(timeInMillis) | Truncates a date, date and time, or time field to the date and returns the result in milliseconds. A time field always returns zero. |
DateFromDateTimeTZ(date,timezone) |
Converts a Date Time value to a Date value based on the given time zone. Example: DateFromDateTimeTZ(10/10/2012 12:00 AM EST,(GMT -5) Eastern Time (US, Canada) [US/Eastern]) returns 10/10/2012 Server Time Zone |
datestring(date,format) |
Returns a string from the date, date and time, or time specified in the format specified. The following replacements are made:
|
DateTimeFromDateTZ(date,timezone) |
Converts a Date value to a DateTime value with respect to a time zone. When this function is applied to a date, it returns a date time value that has the time value zeroed to 12 midnight. Example: DateFromDateTimeTZ(10/8/2012,UTC-8) returns 10/8/2012 12:00 AM UTC-8 |
datetimestring(date,format,timezone) | Returns a string from the date, date and time, or time specified in the format and time zone specified. |
DayOfMonth(timeInMillis) | Returns the numeric value of the day of the month (1-31) from the date, date and time, or time specified. A time field always returns zero. |
DayOfWeek(timeInMillis) | Returns the numeric value of the day of the week (1-7) from the date, date and time, or time specified. 1=Sunday, 2=Monday, …, 7=Saturday. A time field always returns zero. |
DigitCount(string) | Returns the number of numeric digit characters in string. |
div(a,b) | Returns the quotient of the number specified as a divided by the number specified as b. Any fractional part is discarded. |
e() | Returns the mathematical constant e. |
endsWith(string,endString) | Both inputs should be text values. Returns TRUE if the first string specified ends with the text specified in endString, otherwise returns FALSE. |
excelMod(a,b) | Returns the module (rest) of the number specified as a divided by the number specified as b. Any fractional part is discarded. |
getBoNameForRecord(recordId) | Returns the business object name of the record ID specified. |
GetDays(startDate,endDate) | Returns the number of days between the two date, date and time, or time values specified. |
getEventsForResource(resourceId,availabilityStart,availabilityEnd,calendarSetName) | Returns the number of events between the availability start date and end date, for the record ID and calendar specified. |
getFirstDateTimeMatchingRrule(startDateTime,rRule,rRuleTimeZone) | Returns the first date and time that match the rule specified. Values for rRuleTimeZone must match values in the Time Zone Classification. |
getModuleNameForRecord(recordId) | Returns the name of the module for the record ID specified. |
getNextEventForResource(resourceId,searchFromDate,calendarSetName) | Returns the next event, counting from a certain date (searchFromDate), for the resource ID and calendar specified. |
getRecordFromId(recordId) | Returns the record content for the record ID specified. |
getRecordsFromId(recordIds) | Returns more than one record contents for the record IDs specified. |
getRuleFromEventUi(eventUiRecordId) | Returns the rule applied to a certain UI event for the record ID specified. |
getUomType(recordId,fieldName) | Returns the type of unit of measurement (UoM) for the record ID and field name specified. |
getUserFormattedDateTime(myProfileRecordId,dateTimeValue) | Returns the user’s date format. |
HasValue(field) | Used in workflow conditions to test if a value has been entered in a field. Supported field types are Number, Date, DateTime, Financial Rollup, and Classification Rollup. The function is true if a value has been entered and false if no value exists. This is not the same as a blank string value, HasValue tests if the value for the field has ever been set. |
Hour(timeInMillis) | Returns the numeric value of the hour (0-11) from the date, date and time, or time specified. |
HourOfDay(timeInMillis) | Returns the numeric value of the hour (0-23) from the date, date and time, or time specified. |
if/If/IF/iF(condition, trueClauseExp, falseClauseExp) | Returns the result of the trueClauseExp expression if the condition expression evaluates to true; otherwise returns the result of the falseClauseExp expression. For more information, see If Expressions below. |
indexof(string,substring) | Both inputs should be text values. Returns the number of characters in the first value that precede the first occurrence of the second value in the first value. If the second value does not occur in the first value, returns -1. |
IPMT(rate,period,numberOfPeriods,presentValue,futureValue,dueType) |
IPMT or Interest Payment formula calculates the interest payment for a given period of an investment based on periodic, constant payments and a constant interest rate. The first input is the interest rate per period, which must be in a fraction form (already divided by 100). The second input is the period for which you want to find the interest and must be in the range 1 to numberOfPeriods. The next input is the total number of payment periods in an annuity. The fourth input is the present value, or the lump-sum amount that a series of future payments is worth right now. Then you have the future value, or the cash balance one wants to attain after the last payment is made. Enter 0 for the default future value which means that annuity based on present value is attained or paid off after the last payment is made. The due type indicates when payments are due. A warning is logged if the type is not supported and, in this case, the platform defaults to 0:
For the presentValue and futureValue parameters, the cash you pay out (such as deposits to savings) is represented by negative numbers; the cash you receive (such as loan) is represented by positive numbers. |
IPMTX(rate,period,numberOfPeriods,presentValue,payment,dueType) |
This is a slight variation of the IPMT formula, where payment is specified instead of the future value. This enhanced formula allows to pre-calculate periodic payment (PMT) before calculating IPMT inside an iteration of periods. Using this formula instead of the regular IPMT yields better performance as it does not have to re-calculate the payment for every iteration. When pre-calculating PMT, make sure to specify the same rate, numberOfPeriods, presentValue, futureValue and dueType parameter values as you would specify for the regular IPMT formula to achieve the correct interest payment result. |
IRR(periods,payment,initial, hint) |
Calculates the Rate of Return (IRR). IRR is related to Net Present Value (NPV). The value of IRR is the rate that will cause the NPV to result in zero. All parameters are Number field type. The hint parameter is a guess at the correct IRR. With a good hint the calculation can be performed much faster. If a hint is not available, 0 can be passed in and the function calculates a reasonable starting point. For example: Given an initial investment of $100,000 and a return of $175,000 for 3 periods, the IRR would be approximately 166%. In the IRR function you would get that using one of the following 2 calls:
When checking results remember that calculating an IRR gives an approximate answer so it is possible that the result from Maximo® Real Estate and Facilities’s IRR function and from Excel might be slightly different. However, given a good hint they should be within a fraction of a percent (+- 0.001). |
IRRX(initial,payments,hint) |
This enhanced formula supports an array of payment values to the IRR calculation. The IRRX function requires 3 parameters and returns an approximate IRR value that is accurate to 12 decimal places. The parameters required are as follows: An initial payment - This is a positive number representing the undiscounted cost of an investment. An array of payments - This is an array of positive numbers representing payments that will be received by the investor against the initial investment. Rate hint - This is a number (positive or negative) that is a best guess or an approximation of the actual IRR. If a good hint is supplied it will make the calculation faster. If no hint is known use the value 0 and a hint will be calculated internally. |
IsAMPM(timeInMillis) | Returns 0 to indicate the date, date and time, or time specified is A.M. and returns 1 to indicate P.M. |
isResourceAvailable(resourceId,availabilityStart,availabilityEnd,calendarSetName) | Returns 0 to indicate the resource ID, within the specified availability start and end, and for a certain calendar, is not available and returns 1 to indicate it is available. |
isResourceAvailableForEventChange(resourceId,eventId,availabilityStart,availabilityEnd,calendarSetName) | Returns 0 to indicate the resource ID, within the specified availability start and end, and for a certain calendar, is not available for a certain event change and returns 1 to indicate it is available. |
ln(number) | The input should be a positive number. Returns the natural (Napierian) logarithm of the number specified. |
log(number) | The input should be a positive number. Returns the logarithm (base 10) of the number specified. |
logn(number,base) | Both inputs should be positive numbers. Returns the logarithm of the number specified in the base specified. |
LowercaseCount(string) | Returns the number of lowercase characters in string. |
MilliSecondOfSecond(timeInMillis) | Returns the numeric value of the millisecond of the second (0-999) from the date, date and time, or time specified. |
MilliSecondsFromDuration(duration) | Returns the milliseconds for the given duration. For example, IF(DURATION>0, MilliSecondsFromDuration(DURATION)/3600000, 0) |
MinuteOfHour(timeInMillis) | Returns the numeric value of the minute of the hour (0-59) from the date, date and time, or time specified. |
mod(a,b) | Returns the remainder of the number specified as a divided by the number specified as b. The sign of the returned value is the same as the sign of b. |
Month(timeInMillis) | Returns the numeric value of the month (1-12) from date, date and time, or time specified. 1=January, 2=February, …, 12=December. |
normsinv(probability) | Returns the inverse normal cumulative distribution of the number specified. |
NPV(periods,payment,rate,initial) | All inputs should be numbers. Returns the net present value. The first input is the number of periods you expect to hold the investment. The second is the projected net cash flow per period. The third is the discount rate, which must be in a fraction form (already divided by 100). The fourth is the capital outlay to initiate the investment. |
NPVX(payments,rate,initial) |
This enhanced formula supports an array of payment values to the NPV calculation. The period will then be determined by the number of payment values passed to the NPVX formula and the order of those values will be followed. All inputs should be numbers. The first input is the result of a query token, which is an array of number values. The second is the rate of discount over the length of one period. The third is the initial cost of investment which is to be deducted from the NPV result. The enhanced query token can be set to Total or Values:
|
pi() | Returns the mathematical constant pi. |
PMT(rate,numberOfPeriods,presentValue,futureValue,dueType) |
The PMT or Payment formula calculates the periodic payment of an annuity based on constant payments and a constant interest rate. It contains the principal payment and interest of an annuity. The function can be used in IPMTX and PPMTX formulas to improve the performance when calculating these formulas inside an iteration of periods. The first input is the interest rate per period, which must be in a fraction form (already divided by 100). The second input is the total number of payment periods in an annuity. The third input is the present value, or the lump-sum amount that a series of future payments is worth right now. Then you have the future value, or the cash balance one wants to attain after the last payment is made. Enter 0 for the default future value which means that annuity based on present value is attained or paid off after the last payment is made. The due type indicates when payments are due. A warning is logged if the type is not supported and, in this case, the platform defaults to 0:
For the presentValue and futureValue parameters, the cash you pay out (such as deposits to savings) is represented by negative numbers; the cash you receive (such as loan) is represented by positive numbers. |
power(number,exponent) | Exponent should be either a non-negative real number or a negative numeric value. Returns the result of the number specified raised to the exponent specified. |
PPMT(rate,period,numberOfPeriods,presentValue,futureValue,dueType) |
The PPMT or Principal Payment formula calculates the principal payment for a given period of an investment based on periodic, constant payments and a constant interest rate. The first input is the interest rate per period, which must be in a fraction form (already divided by 100). The second input is the period for which you want to find the principal payment and must be in the range 1 to numberOfPeriods. The next input is the total number of payment periods in an annuity. The fourth input is the present value, or the lump-sum amount that a series of future payments is worth right now. Then you have the future value, or the cash balance one wants to attain after the last payment is made. Enter 0 for the default future value which means that annuity based on present value is attained or paid off after the last payment is made. The due type indicates when payments are due. A warning is logged if the type is not supported and, in this case, the platform defaults to 0:
For the presentValue and futureValue parameters, the cash you pay out (such as deposits to savings) is represented by negative numbers; the cash you receive (such as loan) is represented by positive numbers. |
PPMTX(rate,period,numberOfPeriods,presentValue,payment,dueType) |
This is a slight variation of the PPMT formula, where payment is specified instead of the future value. This formula allows to pre-calculate periodic payment (PMT) before calculating the PPMT inside an iteration of periods. Using this formula instead of the regular PPMT yields better performance as it does not have to re-calculate the payment in every iteration. |
RandomNumber() | Returns a pseudo random number greater than or equal to 0 and less than 1. This function does not take any arguments. |
RandomString(minLen,maxLen,style) |
Generates a random string value that is at least minLen characters long and no longer than maxLen. The string is generated using English characters (a-Z) and digits (0-9) based on rules defined by the style parameter. minLen and maxLen Define the minimum and maximum length of the generated string. The generated string will be at least minLen characters long and will be no longer than maxLen characters long. If minLen is less than 1 it will default to 1. If maxLen is less than minLen the minimum length will be used. style |
RandomString(minLen,maxLen,style) [continued] |
The style parameter is a string that is used to control certain aspects of the format of the generated string. Except for the special characters ‘0’, ‘1’, ‘i’, ‘I’, ‘l’, ‘L’, ‘o’, and ‘O’ (see below) the characters used in the style parameter do not matter.
|
RandomString(minLen,maxLen,style) [continued] |
If the length of the generated string does not allow all the rules to be satisfied, the rules that specify the starting type take priority. For instance, if the generated string is two characters long and the rules specify to start with a digit and have mixed case; the string will start with a digit but will not have both uppercase and lowercase characters. Style Examples:
|
replace(string,oldstring,newstring) | All inputs should be text values. Returns the first string with all occurrences of the second string replaced with the third string. |
replaceCRLF(string, replaceString) |
All inputs should be text values. Returns the first string with all occurrences of the carriage return line break (CRLF) replaced with the second string. Example:
|
Round(value,precision) |
Rounds the fractional portion of value to the number of decimal places given by precision. The operation looks at the fractional digits to the right of the digit given by precision to determine the value of the fractional digit at precision and returns the converted value. If the digit to the right is 5 or greater, the digit at precision is rounded up. If the digit to the right is 4 or less, the digit at precision is rounded down. This operation is sometimes referred to as ‘Round Half Up’. The value of precision should be greater than or equal to zero. If precision is less than zero it is treated as zero. Examples:
|
RoundDown(value,precision) |
Rounds the fractional portion of a value to the number of decimal places given by precision. The operation effectively truncates the value at the number of decimal places given by precision, discarding any fractional value to the right of the digit at precision. Examples:
|
RoundUp(value,precision) |
Rounds the fractional portion of a value to the number of decimal places given by precision. The operation increases the value of the digit at precision if there are any digits to the right of the digit at precision. Examples:
|
RoundX(value,precision, mode) |
RoundX provides control of the rounding function via the mode parameter. There are seven modes.
Examples:
|
RoundX(value,precision, mode) [continued] |
|
SecondOfMinute(timeInMillis) | Returns the numeric value of the second of the minute (0-59) from the date, date and time, or time specified. |
sqrt(number) | The input should be a non-negative number. Returns the square root of the number specified. |
startsWith(string,endString) | Both inputs should be text values. Returns TRUE if the first string starts with the second string; otherwise returns FALSE. |
stringlength(string) |
Returns the number of characters in the string specified. The first position is zero. Note:
|
substring(string,start,end) |
Returns the portion of the string specified that starts and ends at the indexes specified. Examples:
|
toDate(dateString) |
Returns the date and time that corresponds to the date and time in the string specified. It recognizes a variety of formats in the text, which follow a predefined sequence:
Note that the input “10/11/2011” is recognized as October 11th since that will match the MM/dd/yyyy format. There is no way for this to be interpreted as the 10th of November. Where the formulas above say “Month”, the month abbreviation (Apr) or the full month name (April) can be used. |
tolower(string) | Returns the string specified with all upper case letters replaced with lower case letters. |
toupper(string) | Returns the string specified with all lower case letters replaced with upper case letters. |
trim(string) |
Returns the string specified with all leading and trailing spaces or control characters removed. Note:
|
UppercaseCount(string) | Returns the number of uppercase characters in string. |
WeekDayDate (timeInMillis,day) | Returns a date value which falls in the week specified in the first input. The second input is the day (1-7), where 1=Sunday, 2=Monday, …, 7=Saturday. |
Year(timeInMillis) | Returns the numeric value of the year from date, date and time, or time specified. |