EvalTest

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

EvalTest

Declaration

function EvalTest( sExpression: String ): Integer;

Description

Tests the validity of an xBase expression.

Parameters

sExpression: Any xBase expression passed as a literal string or as the contents of a string variable.

Return Value

If the expression is a valid xBase expression (i.e., it can be parsed by the Apollo expression evaluator), the return is an integer indicating the data type that will result if the expression is evaluated.

 

If the expression cannot be evaluated, 0 is returned.

 

The data types returned from a valid test are:

EVAL_CHARACTER 1

EVAL_NUMERIC 2

EVAL_LOGICAL 3

EVAL_DATESTRING 4

Delphi Example

procedure Form1.Button1Click(Sender: TObject);

var

 iResult: Integer; 

begin

// Find out the type of expression entered by user 

iResult := ApTbl.EvalTest( Edit1.Text );

 

case iResult of 

 EVAL_CHARACTER : ShowMessage( 'Character expression!' ); 

 EVAL_NUMERIC : ShowMessage( 'Numeric expression!' ); 

 EVAL_LOGICAL : ShowMessage( 'Logical expression!' ); 

 EVAL_DATESTRING: ShowMessage( 'Date String expression!' ); 

else 

  ShowMessage( 'Invalid expression!' ); 

end; 

end;

See Also

EvalLogical, EvalNumeric, EvalString, xBase Expression Engine