CreateExpression()
Summary
Creates an expression field on a view.
Syntax
expr = CreateExpression(string view_name, string expr_name, string expression, array options)
| Argument | Contents |
|---|---|
| view_name | The view on which to create the expression field |
| expr_name | The name you want to use for the expression field |
| expression | An expression |
| Option | Type | Contents |
|---|---|---|
| Type | String | The data type of the expression field; supported types are "Integer", "Real" or "String" |
| Width | Integer | The display width |
| Decimals | Integer | The number of decimal places displayed |
Returns
A string that contains the actual name of the expression field.
Notes
-
The field type, display width, and number of displayed decimals are automatically determined if they are not specified in the options array.
Example
pd_field_name = CreateExpression("U.S. States", "Pop Density", "Population/Area", )
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The expression is null or invalid; expr_name is null or invalid; or the expression field type is not specified and cannot be determined |
| NotFound | The specified view does not exist, or the input view_name is null and there is no current view |
See Also
| Function | Summary |
|---|---|
| VerifyExpression() | Verifies the validity of an expression |
| DestroyExpression() | Destroys an expression field |
| GetExpressions() | Returns an array of all expression fields defined in a view |
| GetExpressionInfo() | Returns information about an expression (formula) field |
| SetColumnArray() | Sets the columns displayed in an editor |