Chapter 10 Using Functions - Liveware Pub

Chapter 10 Using Functions

Introduction

R&R offers over 100 predefined functions you can use in calculated field expressions. A predefined function is a formula that performs a specified operation such as returning the system date or the current page number.

You can also define and save your own user-defined functions (UDFs) that can be used in any report just like predefined functions. For information about UDFs, see the Using User-Defined Functions section of this chapter.

Figure 10.1 lists and briefly describes the functions, using the abbreviations listed below to indicate the input and output data type of each expression. Note that the R&R N data type accommodates any numeric value.

Abbreviation A C D DT I

L N T

Refers To A table alias A character expression A date expression A datetime or time expression An item (numeric, character, date, memo, or logical) A logical expression A numeric expression A time expression

Brackets around the abbreviation for an input argument (for example [A]) indicate that the argument is optional.

Using R&R, Windows Xbase Edition

151

Selecting and Analyzing Data

Function ABS ADDDAYS ADDMONS ADDWKS ADDYRS AGED ASC AT BLANKNUM CAPFIRST CASE CDLL CDOW CHR CLOOKUP CMONTH COPY CTDT CTOD CTOS CTOT DATE DAY DAYSBTWN DBF DELETED DLOOKUP DOW DQTR DTEADD DTEDIFF DTEPART DTLOOKUP DTOC DTTOC ERROR

Description Returns absolute value Adds number of days to date Adds number of months to date Adds number of weeks to date Adds number of years to date Determines aged status of date Converts character to numeric code Searches substring Returns an empty numeric value Converts first letter to upper case Returns result based on value of item Enables calling of a DLL-based function Converts day of date to character Converts numeric code to character Returns character value from another table Converts month of date to character Returns number of copy currently printing Converts character value to datetime Converts character to date Converts character interval to seconds Converts character value to time Returns system date Returns day-of-month number Calculates number of days between dates Returns full path and name of table Identifies deleted record Returns date value from another table Calculates day-of-week number Calculates date of first day of quarter Adds specified interval to datetime Calculates difference between datetime values Returns specified interval as an integer Returns datetime value from another table Converts date to character string Converts datetime to character string Returns true if item has error value

Input Data Type N D,N D, N D, N D, N D,N,N C C, C, [L] none C,[C] I,I,[I,...]default C, C, C D N I,C,C,C,[C] D none C C C C none D D, D [A] A I,C,C,C,[C] D D I,N,DT I,DT,DT I,DT I,C,C,C,[C] D, [N] DT I

Output Type N D D D D L N N N C I C C C C C N DT D DT DT D N N C L D N D DT N N DT C C L

152

Using R&R, Windows Xbase Edition

Chapter 10 Using Functions

EXP

Calculates the value of e**n

N

N

FLIP

Swaps words before and after a character

C, C

C

Figure 10.1 Function Descriptions (Continued on Next Page)

Using R&R, Windows Xbase Edition

153

Selecting and Analyzing Data

Function FUTURE HALF HISCOPE IIF INLIST INRANGE INT ISALPHA ISBLANK ISLOWER ISUPPER LEFT LEN LIBNAME LLOOKUP LOG LOSCOPE LOWER LTRIM LUPDATE MAX MIN MOD MONLEN MONSBTWN MONTH NDOW NLOOKUP OVER

PAGENO PAST PDOW PREVIOUS QTR QUERY

Description Determines whether date is in the future Returns calendar half-year of date Returns high scope value Selects one of two expressions Looks up value in list of values Determines if value is within range Discards digits to right of decimal Determines if first character is a letter Determines if value is blank Determines if first character is lower case Determines if first character is upper case Selects substring starting at left Calculates length of string or field Returns full path of current report library Returns logical value from another table Returns natural logarithm Returns low scope value Converts upper to lower case Removes leading blanks Returns date of last table update Returns higher of two values Returns lower of two values Returns the remainder of division Returns number of days in month Calculates months between two dates Returns month-of-year number Returns date of next specified DOW Returns numeric value from another table Determines whether date is past specified number of days Returns current report page number Determines whether date is in the past Returns date of previous specified DOW Returns value in previous composite record Calculates calendar quarter of date Returns current query expression

Input Data Type D, [N] D none I, I, I I, [I,...] I, I, I N C I C C C, N C none I,C,C,C,[C] N none C C A N, N N, N N, N D D, D D D,N I,C,C,C,[C] D,N

none D,[N] D,N I D none

Output Type L N C I N L N L L L L C N C L N C C C D N N N N N N D N L

N L D I N C

154

Using R&R, Windows Xbase Edition

RECCOUNT RECNO REPLICATE

Returns record count of table Returns composite record number Repeats character expression

Figure 10.1 Function Descriptions (Cont'd)

Chapter 10 Using Functions

A

N

[A]

N

C, N

C

Using R&R, Windows Xbase Edition

155

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download