Documentation Function

From RLIB

Jump to: navigation, search

Definitions:

    exp: An Expression of any type
    expN: A NUMBER Expression 
    expS: A STRING Expression
    expD: A DATE Expression
    TRUE: NUMBER 1
    FALSE: NUMBER 0
    YES: NUMBER 1
    NO: NUMBER 0

Contents

+

    * Add two NUMBERS
    * Concatinate two STRINGS
    * Add days to a DATE
    expN + expN RETURNS NUMBER
    Example: 5 + 2.4 RETURNS 7.4
    expS + expS RETURNS STRING
    Example: 'bacon' + 'eggs' RETURNS 'baconeggs'
    expD + expN RETURNS DATE
    Example: stod('2004-01-01') + 1 RETURNS 2004-01-02

-

    * Subtract two NUMBERS
    * Subtract days from a DATE
    expN - expN RETURNS NUMBER
    Example: 5 - 2.5 RETURNS 2.5
    expD - expN RETURNS DATE
    Example: stod('2004-01-02') - 1 RETURNS 2004-01-01

*

    * Multiply two NUMBERS
    expN * expN RETURNS NUMBER
    Example: 5 * 2 RETURNS 10

/

    * Divide two NUMBERS
    Note: Division by zero will return 0
    expN / expN RETURNS NUMBER
    Example: 10 / 2 RETURNS 5

 %

    * Mod two NUMBERS
    expN % expN RETURNS NUMBER
    Example: 5 % 2 RETURNS 1

^

    * Power of two NUMBERS
    expN ^ expN RETURNS NUMBER
    Example: 5 ^ 2 RETURNS 25

<

    * Perform Less than comparison of two NUMBERS
    * Perform Less than comparison of two STRINGS
    * Perform Less than comparison of two DATES
    NOTE: IN XML YOU CAN NOT USE '<' YOU MUST USE '&lt;' instead
    expN1 < expN2 RETURNS TRUE if expN1 < expN2 otherwise RETURNS FALSE
    Example: 4 < 5 RETURNS TRUE
    expS1 < expS2 RETURNS TRUE if expS1 is alphabetically less then expS2 otherwise RETURNS FALSE
    Example: 'one' < 'two' RETURNS TRUE
    expD1 < expD2 RETURNS TRUE if expD1 < expD2 otherwise RETURNS FALSE
    Example: stod('2004-01-01) < stod('2004-01-02') RETURNS TRUE

<=

    * Preforms Less then Equal on two NUMBERS
    * Preforms Less then Equal on two STRINGS
    * Preforms Less then Equal on two DATES
    NOTE: IN XML YOU CAN NOT USE '<=' YOU MUST USE '&lt;=' instead
    expN1 <= expN2 RETURNS TRUE if expN1 <= expN2 otherwise RETURNS FALSE
    Example: 5 <= 5 RETURNS TRUE
    expS1 <= expS2 RETURNS TRUE if expS1 is alphabetically less then or equal to expS2 otherwise RETURNS FALSE
    Example: 'one' <= 'two' RETURNS TRUE
    expD1 <= expD2 RETURNS TRUE if expD1 <= expD2 otherwise RETURNS FALSE
    Example: stod('2004-01-01) <= stod('2004-01-02') RETURNS TRUE

>

    * Preforms Greater then on two NUMBERS
    * Preforms Greater then on two STRINGS
    * Preforms Greater then on two DATES
    NOTE: IN XML YOU CAN NOT USE '>' YOU MUST USE '&gt;' instead
    expN1 > expN2 RETURNS TRUE if expN1 > expN2 otherwise RETURNS FALSE
    Example: 5 > 4 RETURNS TRUE
    expS1 > expS2 RETURNS TRUE if expS1 is alphabetically greater then expS2 otherwise RETURNS FALSE
    Example: 'two' > 'one' RETURNS TRUE
    expD1 > expD2 RETURNS TRUE if expD1 > expD2 otherwise RETURNS FALSE
    Example: stod('2004-01-02) > stod('2004-01-01') RETURNS TRUE

>=

    * Preforms Greater then Equal on two NUMBERS
    * Preforms Greater then Equal on two STRINGS
    * Preforms Greater then Equal on two DATES
    NOTE: IN XML YOU CAN NOT USE '>=' YOU MUST USE '&gt;=' instead
    expN1 >= expN2 RETURNS TRUE if expN1 >= expN2 otherwise RETURNS FALSE
    Example: 4 >= 4 RETURNS TRUE
    expS1 >= expS2 RETURNS TRUE if expS1 is alphabetically greater then or equal to expS2 otherwise RETURNS FALSE
    Example: 'two' >= 'one' RETURNS TRUE
    expD1 >= expD2 RETURNS TRUE if expD1 >= expD2 otherwise RETURNS FALSE
    Example: stod('2004-01-02) >= stod('2004-01-01') RETURNS TRUE

==

    * Performs Equal on two NUMBERS
    * Performs Equal on two STRINGS
    * Performs Equal on two DATES
    expN1 == expN2 RETURNS TRUE if expN1 == expN2 otherwise RETURNS FALSE
    Example: 4 == 4 RETURNS TRUE
    expS1 == expS2 RETURNS TRUE if expS1 is equal to expS2 otherwise RETURNS FALSE
    Example: 'one' == 'one' RETURNS TRUE
    expD1 == expD2 RETURNS TRUE if expD1 == expD2 otherwise RETURNS FALSE
    Example: stod('2004-01-01) == stod('2004-01-01') RETURNS TRUE

 !=

    * Preforms Not Equal on two NUMBERS
    * Preforms Not Equal on two STRINGS
    * Preforms Not Equal on two DATES
    expN1 != expN2 RETURNS TRUE if expN1 != expN2 otherwise RETURNS FALSE
    Example: 3 != 4 RETURNS TRUE
    expS1 != expS2 RETURNS TRUE if expS1 is not equal to expS2 otherwise RETURNS FALSE
    Example: 'one' != 'two' RETURNS TRUE
    expD1 != expD2 RETURNS TRUE if expD1 != expD2 otherwise RETURNS FALSE
    Example: stod('2004-01-01) != stod('2004-01-02') RETURNS TRUE

&&

    * Logical AND
    NOTE: IN XML YOU CAN NOT USE '&&' YOU MUST USE '&amp;&amp;' instead
    Can be used in expressions of the same type:
    expN1 && expN2 RETURNS TRUE if expN1 != 0 AND expN2 != 0 otherwise RETURNS FALSE
    expS1 && expS2 RETURNS TRUE if both expS expressions are non-NULL strings otherwise RETURNS FALSE
    expD1 && expD2 RETURNS TRUE always
    Otherwise it can be used in any logical expressions (because they return NUMBERs):
    Example: 1 && 0 RETURNS FALSE
    Example: 1 == 1 && 2 == 2

&

    * Bitwise AND, performs binary AND between two NUMBERs
    NOTE: IN XML YOU CAN NOT USE '&' YOU MUST USE '&amp;' instead
    Example: 1 & 3 RETURNS 1

||

    * Logical OR
    Can be used in any expression
    Example: 1 == 2 || 2 == 2

|

    * Bitwise OR, performs binary OR between two NUMBERs
    Can be used in any expression
    Example: 1 | 2 RETURNS 3

iif(exp, exp, exp)

    * In Line If
    * iif(EVAULATION EXP, TRUE EXP, FALSE EXP)
    Example: iif(5 == 4, 'Equal', 'Not Equal') RETURNS 'Not Equal'
    Example: iif('bacon' == 'eggs' || 'test' == 'test', 'Pass', 'Fail') RETURNS 'Pass'

abs(expN)

    * Absolute Value
    * RETURNS NUMBER
    Example: abs(-2.1) RETURNS 2.1

ceil(expN)

    * Round up to the nearest integer
    * RETURNS NUMBER
    Example: ceil(2.1) RETURNS 3

floor(expN)

    * Round down to the nearest integer
    * RETURNS NUMBER
    Example: floor(2.1) RETURNS 2

round(expN)

    * Round using 5/4 logic
    * RETURNS NUMBER
    Example: round(2.4) RETURNS 2
    Example: round(2.5) RETURNS 3

sin(expN)

    * Sine of expN, where expN is given in radians
    * RETURNS NUMBER
    Example: sin(90) RETURNS 0.893996664

cos(expN)

    * Cosine of expN, where expN is given in radians
    * RETURNS NUMBER
    Example: cos(90) RETURNS -0.448073616

ln(expN)

    * Natural logarithm of expN
    * RETURNS NUMBER
    Example: ln(100) RETURNS 4.60517019

exp(expN)

    * Returns the value of e (the base of natural logarithms) raised to the power of expN
    * RETURNS NUMBER
    Example: exp(1) RETURNS 2.71828183

atan(expN)

    * Calculates the arc tangent of expN; that is the value whose tangent is expN
    * RETURNS NUMBER
    Example: atan(90) RETURNS 1.55968567

sqrt(expN)

    * Returns the non-negative square root of expN
    * RETURNS NUMBER
    * Note: Only positive values should be passed as expN
    Example: sqrt(16) RETURNS 4

val(expS)

    * Convert a string to a number
    * RETURNS NUMBER
    Example: val('10.123') RETURNS 10.123 as a NUMBER

fxpval(expS, expN)

    * Convert a string representing a number stored with out a decimal place to a number
    * expN is the number of decimal places the number has
    * RETURNS NUMBER
    Example: val('1023', 2) RETURNS 10.23 as a NUMBER

str(expN1, expN2, expN3)

    * Convert a number to a string
    * expN1 is the number to be converted
    * expN2 is the length of the resulting string
    * expN3 is the number of decimal places to have
    * RETURNS STRING
    Example: str(10.23,5,2) RETURNS '10.23' as a STRING

stodt(expS)

    * Convert a string containing a date/time stamp to a DATE
    * Must be in the format of YYYYMMDDHHMMSS
    * RETURNS DATE
    Example: stodt('20050101103030')

stodtsql(expS)

    * Convert a string containing a date time stamp to a DATE, usually this function us used on queries from SQL
    * Must be in the format of YYYY-MM-DD HH:MM:SS
    * RETURNS DATE
    Example: stodtsql('2005-01-01 10:30:30')

stod(expS)

    * Convert a string containing a date to a DATE
    * Must be in the format of YYYY-MM-DD
    * RETURNS DATE
    Example: stod('2005-01-01')

tstod(expS)

    * Convert a string containing a timestamp to a DATE
    * The "date" portion of the date will be filled as 1980-01-01
    * Must be in the format of  HH:MM, HH:MM:SS, HH:MMp, HH:MM:SSp, HHMM, HHMMSS, HHMMp, HHMMSSp
    * RETURNS DATE
    Example: tstod('20:20')

dtos(expD)

    * Convert a DATE to a STRING
    * The date is formatted as YYYY-MM-DD
    * RETURNS STRING
    Example: dtos(stod('2005-01-01'))

dtosf(expS, expD)

    * Convert a DATE to a STRING according to the format given in expS
    * The date is formatted using g_date_strftime(), its documentation is at:
      http://library.gnome.org/devel/glib/2.8/glib-Date-and-Time-Functions.html
      The format string accepts standard C strftime() date-formatting macros.
    * RETURNS STRING
    Example: dtosf('%Y/%m/%d', stod('2005-01-01')) RETURNS '2005/01/01'

year(expD)

    * Returns the Year portion of a Date
    * RETURNS NUMBER
    Example: year(stod('2005-01-01'))

month(expD)

    * Returns the Month portion of a Date
    * RETURNS NUMBER
    Example: month(stod('2005-01-01'))

day(expD)

    * Returns the Day portion of a Date
    * RETURNS NUMBER
    Example: day(stod('2005-01-01'))

dim(expD)

    * Returns the number of days in a month
    * RETURNS NUMBER
    Example: dim(stod('2005-01-01'))

wiy(expD)

    * Returns NUMBER containing the week number of the year.  Range  00  to  53, starting with the first 
      Sunday as the first day of week 01
    * RETURNS NUMBER
    Example: wiy(stod('2005-01-01'))

wiyo(expD, expN)

    * Returns NUMBER containing the week number of the year.  Range  00  to  53, starting with the first 
      expN as the first day (1=Monday, 2=Tuesday, ...)
    * RETURNS NUMBER
    Example: wiyo(stod('2005-01-01'), 3)

date()

    * Returns the current date
    * RETURNS DATE
    Example: date()

dateof(expD)

    * Convert a datetime to a date only variable.  Use this function with comparisons and DATE arithmetic to 
      select only the DATE portion for use in the expression.
    * RETURNS DATE
    Example: dateof(date())

timeof(expD)

    * Convert a datetime to a time only variable.  Use this function with comparisons and DATE arithmetic to 
      select only the time portion for use in the expression.
    * RETURNS TIME
    Example: timeof(date())

chgdateof(expD1, expD2)

    * Changes the date portion of expD1 to equal that of expD2.
    * RETURNS DATE
    Example: chgtimeof(date(), stod(some_other_date_time))

chgtimeof(expD1, expD2)

    * Changes the time portion of expD1 to equal that of expD2.
    * RETURNS DATE
    Example: chgtimeof(date(), stod(some_other_date_time))

gettimeinsecs(expD)

    * Returns the time portion of the datetime variable as the number of seconds past 00:00:00
    * RETURNS NUMBER
    Example: gettimeinsecs(some_date_time_variable)

settimeinsecs(expD, expN)

    * Returns a datetime with the time portion of the datetime changed to a value obtained by adding expN 
      seconds to 00:00:00.  
    * For example: "settimeinsecs(expD, (gettimeinsecs(expD) / 3600) * 3600)"
      returns a datetime that has been truncated to an even hour value.
    * RETURNS DATE
    Example: settimeinsecs(expD, (gettimeinsecs(expD) / 3600) * 3600)

upper(expS)

    * Makes a string upper case
    * RETURNS STRING
    Example: upper('bacon') RETURNS 'BACON' as a STRING

lower(expS)

    * Makes a string lower case
    * RETURNS STRING
    Example: lower('EGGS') RETURNS 'eggs' as a STRING

proper(expS)

    * Make the 1st character of a string upper case
    * RETURNS STRING
    Example: proper('bob') RETURNS 'Bob' as a STRING

strlen(expS)

    * Returns the length of expS
    * RETURNS NUMBER
    Example: strlen('bacon') RETURNS 5 as a NUMBER

left(expS, expN)

    * Returns the left most expN characters
    * RETURNS STRING
    Example: left('bacon and eggs', 5) RETURNS 'bacon' as a STRING

right(expS, expN)

    * Returns the right most expN characters
    * RETURNS STRING
    Example: right('bacon and eggs', 4) RETURNS 'eggs' as a STRING

mid(expS, expN1, expN2)

    * Returns the a string of length expN2 starting at expN1
    * RETURNS STRING
    Example: mid('bacon and eggs', 7, 3) RETURNS 'and' as a STRING

isnull(exp)

    * Returns YES if exp is null, NO if it is not
    * RETURNS NUMBER (boolean)
    Example: isnull('dude') RETURNS 0 as a NUMBER

format(exp, expS)

    * Formats the passed exp_ (may be expD, expS or expN) using the expS parameter as a format string.
      Format strings must be in the new '!' format.  SEE FORMATTING
    * This function will format the passed variable using the passed format string.
      Character strings may be formatted using the format symbol '!!'.
      Errors will be generated if the type for the format string does not match the variable type.
      format headers are: '!!' for strings, '!@' for datetimes, '!#' for numbers and '!$' for currency.
    * RETURNS STRING
    * Example: format('xyx', '!!%6s') 

eval(expS)

    * Compile and Execute expS on the fly
    * Example: eval('1+2') NOTE HOW 1+2 is a string

[_pw9_]

nvnv


Personal tools