Partager via


EVL( ) Function

Returns a non-empty value from two expressions.

You can use the EVL( ) function to return an appropriate substitute value instead of an empty value, such as False (.F.) or 0, from two expressions. You can also use this functionality to remove empty values from calculations or operations where empty values are not supported or relevant.

Note   The Visual FoxPro Logical value, False (.F.), and the Numeric value of 0 also evaluate to empty.

EVL( eExpression1, eExpression2 )

Parameters

  • eExpression1, eExpression2
    Specifies two expressions. eExpression1 and eExpression2 can be any data type except the following:
    • General fields: If eExpression1 or eExpression2 represents a General field, EVL( ) returns an error, "Operation is invalid for a General field. (Error 1912)"
    • Object references

Return Values

Character, Date, DateTime, Numeric, Currency, Logical, Object reference. EVL( ) returns eExpression1 if it does not evaluate to an empty value; otherwise, it returns eExpresssion2.

Example

The following examples create the memory variables, glEmptyDate, which contains an empty Date value, and glEmptyNum, which contains an empty Numeric value, 0.

When performing EVL( ) with glEmptyDate, EVL( ) returns an empty string ("") when evaluating glEmptyDate and an empty string, and "None" when evaluating glEmptyDate and "None".

STORE {  /  /  } TO glEmptyDate  
? EVL(glEmptyDate,"")
? EVL(glEmptyDate, "None")

When performing EVL( ) with glEmptyNum, EVL( ) returns an empty string when evaluating glEmptyNum and an empty string, and "Empty" when evaluating glEmptyNum and "Empty".

STORE 0 TO glEmptyNum  
? EVL(glEmptyNum,"")            
? EVL(glEmptyNum, "Empty")      

See Also

Functions | EMPTY( ) Function