#

Expressions Reference

Chapter Updated 2/12/99

### Expression Operands

Operand | Type | Function
+ | Alpha | Concatonate
+ | Numeric | Addition
- | Alpha | Concatonate, remove white space
- | Numeric | Subtraction
* | Numeric | Multiplication
/ | Numeric | Division
** | Numeric | Exponentiation
< | Logical | Less Than
> | Logical | Greater Than
= | Logical | Equal
<> | Logical | Not Equal
# | Logical | Not Equal
<= | Logical | Less Than or Equal
>= | Logical | Greater Than or Equal
$ | Logical | Contains
-> | N/A | Identifies database field ie; DATABASE->FIELD

### Expression Functions

Expression Function | Xbase C++ Method | Description
ABS() | xbDouble EXPN::ABS( xbDouble d ) | Returns absolute numeric value of argument.
ASC() | xbLong EXPN::ASC( char * String ) | Returns ASCII code of left character of string.
AT() | xbLong EXPN::AT( char *s1, char *s2 ) | Returns starting position of first alphanumeric argument in second argument.
CDOW() | char * EXPN::CDOW( char Date8 ) | Returns name of the day of the week of Date8.
CHR() | char * EXPN::CHR( xbLong l ) | Returns ASCII character corresponding to numeric value supplied.
CMONTH() | char * EXPN::CMONTH( char * Date8 ) | Returns name of the month of Date8.
DATE() | char * EXPN::DATE() | Returns system date.
DAY() | xbLong EXPN::DAY( char * Date8 ) | Returns numeric value of the day of the month for Date8.
DESCEND() | EXPN::DESCEND() | Descend
DTOC() | char * EXPN::DTOC( char * Date8 ) | Returns a date converted to format MM/DD/YY.
EXP() | xbDouble EXPN::EXP( xbDouble d ) | Returns exponential for supplied value.
INT() | xbLong EXPN::INT( xbDouble d ) | Converts any numeric value to an integer.
ISALPHA() | xbLong EXPN::ISALPHA( char * String ) | Returns TRUE if string is alpha.
ISLOWER() | xbLong EXPN::ISLOWER( char * String ) | Returns TRUE if string is lower case.
ISUPPER() | xbLong EXPN::ISUPPER( char * String ) | Returns TRUE if string is upper case.
LEFT() | char * EXPN::LEFT( char * String, xbShort Len ) | Returns Len characters from the left side of String.
LEN() | xbLong EXPN::LEN( char * String ) | eturns the number of characters in the String.
LOG() | xbDouble EXPN::LOG( xbDouble d ) | Returns the natural log of d.
LOWER() | char * EXPN::LOWER( char * String ) | Converts a string to lower case.
LTRIM() | char * EXPN::LTRIM( char * String ) | Eliminates leading white space from String.
MAX() | xbDouble EXPN::MAX( xbDouble d1, xbDouble d2 ) | Returns the larger of two numeric arguments.
MIN() | xbDouble EXPN::MIN(xbDouble d1, xbDouble d2 ) | Returns the smaller of two numeric arguments.
MONTH() | xbLong EXPN::MONTH( char * Date8 ) | Returns numeric month for Date8.
REPLICATE() | char * EXPN::REPLICATE( char * String, xbShort Count ) | Replicates String Conut times.
RIGHT() | char * EXPN::RIGHT( char * String, xbShort Count ) | Returns Count characters from the right side of String.
RTRIM() | char * EXPN::RTRIM( char * String ) | Removes trailing white space from String.
SPACE() | char * EXPN::SPACE( xbShort Count ) | Returns a buffer filled with Count spaces.
SQRT() | xbDouble EXPN::SQRT( xbDouble d ) | Returns square root of d.
STR() | char * EXPN::STR( xbDouble d ) | Converts a number to a string.
SUBSTR() | char * EXPN::SUBSTR( char * String, xbShort StartPos, xbShort Len ) | Returns a string form String starting at position StartPos for a length of Len.
TRIM() | char * EXPN::TRIM( char * String ) | Same as RTRIM.
UPPER() | char * EXPN::UPPER( char * String ) | Converts a string to upper case.
VAL() | xbLong EXPN::VAL( char * String ) | Converts a string to an integer.
YEAR() | xbLong EXPN::YEAR( char * Date8 ) | Returns numeric year from Date8.

### Expression Processing Method List

Method | Description
GetCharResult() | Get char * result from processed expression
GetDoubResult() | Get xbDouble result from processed expression
GetIntResult() | Get a xbLong result from processed expression
GetExpressionHandle() | Get an expression's handle
GetExpressionResultType(xbExpression *) | Get expression result type
ParseExpression(char *,xbDbf *) | Parse an expression
ProcessExpression(xbExpression *) | Process a parsed expression

### Method Definitions

### Method char * xbXBase::GetCharResult()

This method returns a char * result from a processed expression.
See the program listing in chapter 5 for an example of how to use this method.

### Method xbDouble xbXBase::GetDoubleResult()

This method returns a xbDouble result from a processed expression.
See the program listing in chapter 5 for an example of how to use this method.

### Method xbLong xbXBase::GetIntResult()

This method returns a xbLong result from a processed expression.
See the program listing in chapter 5 for an example of how to use this method.

### Method xbExpression * xbXBase::GetExpressionHandle()

This method returns a handle to a recently parsed expression.
See the program listing in chapter 5 for an example of how to use this method.

### Method char xbXBase::GetExpressionResultType( xbExpression * e )

This method returns the result type for a given expression e.

### Method Return Codes

Return Code Value | Description
C | char * result from processed expression
N | xbDouble result from processed expression
L | xbLong (also logical) result from processed expression

See the program listing in chapter 5 for an example of how to use this method.

### Method xbShort ParseExpression( char * exp, DBF * d)

This method parses expression exp.
d is a pointer to a database used for resolving any fieldname which does not contain the <en>-> operator.
See the program listing in chapter 5 for an example of how to use this method.

### Method xbShort ProcessExpression( xbExpression * e )

This method processes parsed expression e.
See the program listing in chapter 5 for an example of how to use this method.

Send me mail - xbase@startech.keller.tx.us

(c)1997 StarTech