sx_EvalTest

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_EvalTest

VB Declaration

Declare Function sx_EvalTest Lib "Apollo9.dll"

(ByVal cpBaseExpr As String)

As Integer

C Declaration

SHORT FAR PASCAL sx_EvalTest(BYTEP cpExpression);

Description

Tests the validity of an xBase expression.

Parameters

cpBaseExpr: 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 and can be parsed by the 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

VB Example

Sub bLocate_Click ()

Dim bContinue As Integer

If Not LocSwitch Then

LocStr$ = InputBox$("Locate condition?", "Locate", "")

If LocStr$ = "" Then Exit Sub

 

If sx_EvalTest(LocStr$) = EVAL_LOGICAL Then

LocSwitch = True

bContinue = False

bLocate.Caption = "&Again"

Else

MsgBox "Error in expression"

Exit Sub

End If

Else

LocStr$ = " "

bContinue = True

End If

MousePointer = 11

If sx_Locate(LocStr$, 0, bContinue) = 0 Then

MsgBox "Not Found"

j& = sx_Locate(0&, 0, 0) ' clears locate memory

LocSwitch = False

bLocate.Caption = "&Locate"

Else

sx_Go sx_RecNo()

End If

MousePointer = 1

End Sub

C Example

// test user filter

if (sx_EvalTest(cpUserFilter) != EVAL_LOGICAL)

AfxMessageBox((LPCSTR) "Invalid filter expression");

else

sx_FilterDlg(GetParent(), cpUserFilter);

See Also

sx_EvalLogical, sx_EvalNumeric, sx_EvalString, xBase Expression Engine