Previous page | Data Integration | Next page |
Expressions - Function Reference |
Expressions can contain the following functions. Functions can be combined using the Operators, and can be nested. Functions are grouped in the following categories:
ConditionalCOALESCECOALESCE(value1, value2[, value10]) Returns the first non-null value. Can be used as a 'NullToZero' function if the second parameter is 0. IIFIIF(condition, truevalue, falsevalue) If [condition] evaluates to true, null, return [truevalue] otherwise return [falsevalue]
Date / TimeDATEDIFFDATEDIFF(datetime1, datetime2) Returns [datetime1] - [datetime2] in days Also see Extended use example below... DATE_FORMATDATE_FORMAT(datetime, format) Formats [datetime] according to [format] DAYDAY(datetime) Day of month of [datetime] (1-31) HOURHOUR(datetime) Hour of [datetime] (0-23) INTERVALINTERVAL(integer,[YEAR|MONTH|DAY|HOUR|MINUTE|SECOND]) Returns an interval that can be added to / subtracted from a date / time Note: In an expression the Interval should be placed after the date ie Date + Interval, not Interval + Date MINUTEMINUTE(datetime) Minute of [datetime] (0-59) MONTHMONTH(datetime) Month of [datetime] (1-12) NOWNOW() Current date and time SECONDSECOND(datetime) Second of [datetime] (0-59) UTC_TIMESTAMPUTC_TIMESTAMP() Current UTC date and time
MathABSABS(number) Absolute value ACOSACOS(number) Inverse cosine ASINASIN(number) Inverse sine ATANATAN(number) Inverse tangent CEILCEIL(number) Smallest integer not less than argument COSCOS(number) Cosine COTCOT(number) Cotangent DEGREESDEGREES(number) Radians to degrees EXPEXP(number) Exponential FLOORFLOOR(number) Largest integer less than argument LNLN(number) Natural logarithm LOGLOG(number1, number2) Logarithm to base [number2] MODMOD(number1, number2) Remainder of [number1] / [number2] PIPI() Pi constant POWERPOWER(number1, number2) [number1] raised to the power [number2] RADIANSRADIANS(number) Degrees to radians RANDOMRANDOM() Returns a random value in the range 0.0 <= x < 1.0 ROUNDROUND(number, precision) Round to [precision] decimal places SIGNSIGN(number) Sign of the argument (-1, 0, 1) SINSIN(number) Sine SQRTSQRT(number) Square root TANTAN(number) Tangent
TextCONST.CURRENTSITE.URLCONST.CURRENTSITE.URL() Returns the domain name of the site. If the site is listening on multiple domain names, it will return the domain name that is being used by this particular request. LEFTLEFT(text, length) Return first [length] characters in the string LOWERLOWER(text) Convert text to lower case LTRIMLTRIM(text) Remove leading spaces REPEATREPEAT(text, number) Repeat [text] the specified [number] times REPLACEREPLACE (string,find,replace) Replaces instances in the [string] of the [find] text with the [replace] text REVERSEREVERSE(text) Return reversed string RIGHTRIGHT(text, length) Return last [length] characters in the string RTRIMRTRIM(text) Remove trailing spaces SUBSTRSUBSTR(text, start[, length]) Return [length] characters from character [start] in the string TRIMTRIM(text) Remove leading and trailing spaces UPPERUPPER(text) Convert text to upper case Conditional expressions can be extended by combination. For example, DATEDIFF only calculates the difference between two date-times in whole numbers of days. If you need to calculate the difference in a number of hours you can use DATEDIFF in combination with the HOUR() function as follows: |