SP_EXPBLOCK

EXPBLOCK()

  Short:
  ------
  EXPBLOCK() Returns a codeblock to evaluate an expresson

  Returns:
  --------
  <bBlock> => codeblock to evaluate an expression

  Syntax:
  -------
  EXPBLOCK(cExpress)

  Description:
  ------------
  Returns a codeblock built around the expression in
  cExpress.

  Using EVAL() on the codeblock will return the current
  value of the expression.

  Examples:
  ---------
   cExp := "UPPER(LEFT(CUSTOMER->LNAME,5))"
   bExp := EXPBLOCK(cExp)

   ?eval(bExp)
     // displays current value of customer->lname, upper,left 5

  Notes:
  -------
  See also WORKBLOCK()

  Source:
  -------
  S_FIELDS.PRG

 

Expression Terms

Assignment :

The act of copying a new value into a variable. In Clipper language this is done with the simple assignment operators (=) and (:=), or the compound operators (+=, -=, *=, **=).

Binary Operator :

An operator that operates on two operands. For example, the addition operator.

See Also: Operator

Character Functions :

Those functions that act upon individual characters or strings of ASCII characters in the performance of their tasks.

See Also: ASCII, Function, String

Concatenate :

To combine two groups of character data together by placing them in a sequence to form a new string of characters.

See Also: Data Type

Condition :

A logical expression that determines whether an operation will take place. With database commands, a logical expression that determines what records are included in an operation. Conditions are specified as arguments of the FOR or WHILE clause.

Conversion Functions :

Generally referring to a category of functions whose purpose is to change one data type to another (e.g., to change a number or a date to a character string).

Date Functions :

Functions that operate on date values (as opposed to character, numeric or other values).

See Also: Function

Decrement :

To decrease a value by a fixed amount, usually one. In Clipper, the decrement operator (–) can be used to decrement a numeric value in a variable.

See Also: Assignment Increment

Destination :

The variable or array element to receive data in an assignment.

See Also: Assignment

Evaluate :

To execute part of a program in order to produce a value. For an expression, to execute the program code associated with the expression and return the resulting value. For the macro operator, to compile the macro string, execute the resulting program code, and return the resulting value.

See also : Expression

Expression :

A combination of constants, identifiers, operators, and functions that yield a single value when evaluated.

Increment :

To increase a value by a fixed amount, usually one. In Clipper language the increment operator (++) can be used to increment a numeric value in a variable.

List :

A list of expressions, field names, or filenames, separated by commas specified generally as command, procedure, or function arguments. Code blocks can also execute a list of expressions.

Macro :

In Clipper language, an operation that allows source code to be compiled and executed at runtime. In Clipper language, the macro symbol (&) does not perform text substitution unless embedded within a character string. Instead, it is generally treated as a unary operator that operates on a character string. The text in the character string is compiled on the fly using a special runtime compiler. The resulting code is then executed, and the value obtained is returned as the result of the macro operation.

See Also: Code Block, Unary Operator

Operand :

A value that is operated on by an operator, or the term in an expression that specifies such a value. For example, in the expression x + 5, x and 5 are operands.

See Also: Operator

Operator :

A symbol that identifies a basic operation. For example, the multiplication operator (*) denotes that two values are to be multiplied. Operators are categorized as either unary or binary, depending on whether they require one or two operands, respectively.

See Also: Binary Operator, Operand, Unary Operator

Precedence :

The stature of an operator in the hierarchy that determines the order in which expressions are evaluated. For example, the expression 5 + 2 * 3 is interpreted as 5 + (2 * 3) because the multiply operator (*) has a higher precedence than the addition operator (+).

See Also: Expression

Recursion :

The calling of a procedure by a statement in that same procedure. When a procedure calls itself it is said to recurse. A recursive call causes a new activation of the procedure. If the source code for the procedure includes a declaration of local variables, a new set of local variables is created for each activation. A private variable created by the procedure is associated with the activation in which it is created, and is visible in that activation and any lower-level activations, unless obscured by a private variable created in a lower-level activation.

See Also: Activation, Function, Private Variable, Procedure

Shortcutting :

A compiler optimization that causes expressions to be evaluated only to the extent required to determine their outcome. For example, in the expression f() .OR. g() function g need not be executed if function f returns true (.T.). Clipper language performs shortcutting on all logical operators (.OR. .AND. .NOT.).

Truncate :

To remove insignificant information from the end of an item of data. With numerics, to ignore any part of the number that falls outside of the specified precision.

Unary Operator :

An operator that operates on a single operand. For example, the .NOT. operator.

See Also: Binary Operator, Operator