Caspio Bridge Function Reference
Math Functions
| Name | Parameters | Example | Description |
| Abs | (number) | Abs(-12) | Returns the absolute value of a number. |
| Acos | (number) | Acos(0.123) | Returns the arccosine of a number in radians. |
| Asin | (number) | Asin(0.123) | Returns the arcsine of a number in radians. |
| Atan | (number) | Atan(0.123) | Returns the arctangent of a number in radians. |
| Atn2 | (x_num, y_num) | Atn2(0.123, 1) | Returns the arctangent of the specified x- and y- coordinates in radians. |
| Ceiling | (number) | Ceiling(0.123) | Rounds a number up to the nearest integer. |
| Cos | (number) | Cos(0.123) | Returns the cosine of an angle. |
| Cot | (Number) | Cot(0.123) | Returns the cotangent of an angle. |
| Degrees | (number) | Degrees(0.123) | Converts radians to degrees. |
| Exp | (number) | Exp(0.123) | Returns e raised to the power of a given number. |
| Floor | (number) | Floor(0.123) | Rounds a number down to the nearest integer. |
| Log | (number) | Log(0.123) | Returns the natural logarithm of a number. |
| Log10 | (number) | Log10(0.123) | Returns the base-10 logarithm of a number. |
| Pi | () | Pi() | Returns the value of Pi. |
| Power | (number, power) | Power(123, 1) | Returns the result of a number raised to a power. |
| Radians | (number) | Radians(0.123) | Converts degrees to radians. |
| Rand | ([number]) | Rand(0.123) | Returns a random number between 0 and 1 using an optional number as a seed. |
| Round | (number, precision) | Round(0.123, 1) | Rounds a number to the specified length or precision. A positive precision indicates the number of digits after the decimal point. A negative precision indicates digits before the decimal point. |
| Sign | (number) | Sign(0.123) | Returns 1, 0, or -1 if the number is positive, zero, or negative, respectively. |
| Sin | (number) | Sin(0.123) | Returns the sine of an angle. |
| Sqrt | (number) | Sqrt(0.123) | Returns the square root of a number. |
| Square | (number) | Square(0.123) | Returns the square of a number. |
| Tan | (number) | Tan(0.123) | Returns the tangent of an angle. |
Text Functions
| Name | Parameters | Example | Description |
| Charindex | (string1, string2 [, start_location] | Charindex ('abc', 'b') | Searches string2 for string1 and returns its starting position if found. The search starts at start_location. |
| Left | (string, number) | Left ('abc', 2) | Returns the left part of a character string with the specified number of characters. |
| Len | (string) | Len ('abc') | Returns the number of characters in the string, without trailing spaces. |
| Lower | (string) | ('abc') | Returns the string converted to lowercase. |
| Ltrim | (string) | (' abc') | Returns the string without leading spaces. |
| Patindex | ('pattern', string) | ('bc', 'abcd') | Returns the starting position of the first occurrence of a pattern in a specified string, or zeros if the pattern is not found. Transact-SQL query wildcards can be used in the pattern. |
| Replace | (string1, strign2, string3) | ('abc', 'a', 'e') | Returns a copy of string1, where all occurrences of string2 are replaced by string3. |
| Reverse | (string) | ('abc') | Returns the reverse of a string. |
| Right | (string, number) | ('abc', 2) | Returns the right part of a character string with the specified number of characters. |
| Rtrim | (string) | ('abc ') | Returns the string without trailing spaces. |
| Space | (number) | (23) | Returns a string of repeated spaces. |
| Str | (number, [length [, precision]]) | (23) | Returns the number as a string, with a given length (default 10). Optional precision defines the number of digits after the decimal point, up to 16. |
| Stuff | (string1, start, length, string2) | ('abcde', 2, 1, 'def') | Inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position. |
| Substring | (string, start, length) | ('abcd', 2, 2) | Returns a substring starting at the starting position defined by start, with total length defined by length. |
| Upper | (string) | ('abc') | Returns the string converted to uppercase. |
Date Functions
| Name | Parameters | Example | Description |
| Dateadd | (datepart, number, date) | (minute, 1, '2011-01-08 05:13') | Adds the number to the specified datepart and returns the new date. |
| Datediff | (datepart, startdate, enddate) | (year, '2011-1-08', '1884-5-23') | Returns the difference between the specified dateparts of two dates. |
| Datepart | (datepart, date) | (weekday, '1884-5-23') | Returns the specified part of the date, as a number. |
| Day | (date) | ('2011-5-23') | Returns an integer representing the day (day of the month) of the specified date. |
| GetUTCDate | () | () | Returns the current system timestamp in UTC time. |
| Month | (date) | ('2011-5-23') | Returns an integer that represents the month of the specified date. |
| Year | (date) | ('2011-5-23') | Returns an integer that represents the year of the specified date. |
| IsDate | (expression) | ('2011-5-23') | Returns 1 if the expression is a valid date, time or datetime value, and 0 otherwise. |
| IsNull | (expression, replace_expression) | ([@field:country], 'USA') | Replaces NULL with the specified replacement value, otherwise returns the result of expression. |
| IsNumeric | (expression) | (23) | Returns 1 if expression is a valid number and 0 otherwise. |
| NullIf | (expression1, expression2) | ('abc','abc') | Returns the first expression if the two expressions are not equal. If the expressions are equal, returns a null value. |
Scaler Functions (Mathematical Operations)
| Name |
| + (add) |
| - (subtract) |
| * (multiply) |
| / (divide) |
| % (modulo) |
| & (bitwise AND) |
| | (bitwise OR) |
| ^ (bitwise XOR) |
| ~ (bitwise NOT) |
Aggregate Functions
| Name | |
| Count | Adds one to the total for each record |
| Count_Not_Blank | Adds one to the total for each record that contains data |
| Min | Displays the smallest record value |
| Max | Displays the largest record value |
| Sum | Displays the sum total of all record values |
| Avg | Displays the average of all record values |
