How To Use Value Expressions

How To Use Value Expressions

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

How To Use Value Expressions

Value expressions represent character or number values.
A value expression is an expression that, when evaluated, yields either a number or a character string.
Value expressions are subdivided into

  • atomic expressions
  • arithmetic expressions
  • functional expressions

A value expression can be very simple, containing only one argument. Such expressions are called atomic expressions. An atomic expression is a value expression that consists solely of
literals (explicit numbers or character strings)
permanent object names (constants, global variables, system variables, fields, form fields)
temporary names (local variables, parameters)
Value expressions can also be quite complex, containing many arguments combined by means of arithmetic operators (arithmetic expressions), or software functions (functional expressions), or both. Parentheses can be used to explicitly control the order of evaluation in complex value expressions.
When a statement contains a value expression, the software evaluates the expression and returns the resulting value. Consequently, a value expression can be used almost anywhere that you can use a literal.

Assigning and Reassigning Values to Atomic Expressions

An atomic expression is a value expression that consists solely of a literal constant, named constant, variable name (including subscript, if applicable), field name, form field name, or formal parameter name.
During an application session, an application program can explicitly set and reset the values of certain atomic expressions, specifically: global and local variables, selected system variables, parameters to formal procedures, and macros. The command that explicitly assigns values to these expressions is the LET command.
Note: To assign values to database fields, you must use an ADD, CHANGE, INSERT, or UPDATE command (which can contain LET as a subcommand).
The LET command can be used as shown in the following example:
let var1='abcd' var2=10.5 var3=var4
The LET command can also make its assignments during the evaluation of a complex value expression that appears within another command statement. The special assignment expression format is created by enclosing the LET command in parentheses.

How To Use Literal Constants

A literal constant is a number or character string written directly into an application program.

Writing Valid Number Constants

Number constants can consist only of the digits 0 to 9 and a decimal point (if required).
Number constants are automatically assigned the data type VASTINT and the number of decimal places shown in the number (if any).

Writing Valid Character Constants

Character constants can contain any digits, letters, or symbols, including reserved characters and hex codes.
Character strings should be enclosed in quotation marks (either single or double), but the quotation marks can be omitted if the string contains only digits, letters, dollar signs ($), and underscores (_), and if the string is not identical to a reserved word.

Examples of Number Literals

3.14159
10
.999

Examples of Character Literals

abcde
"$10.99"
1234A
""

Was this article helpful?
5 out of 5 stars

1 rating

5 Stars 100%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish