constant(

constant(

FORMULA

)
The** constant( **function converts an expression into a constant value (that can be plugged into a new formula).

**Parameters**

** formula** – is the formula you want to convert into a constant.

**Description**

The *constant(* function converts an expression into a constant value. It determines the type of value generated by the expression, then adds quoting as necessary to make a valid constant that can be used to assemble a formula.

Suppose a program initialized two variables *a* and *b* like this:

```
let a = 1
let b = "hello"
```

Then various incancations of the *constant(* function will produce these results.

`constant(a) ☞ `*1*
constant(b) ☞ *"hello"*
constant(b+a) ☞ *"hello1"*
constant(c) ☞ *error("Field or Variable [c] does not exist.")*

Essentially the *constant(* function provides a way to “freeze” the current value of a variable, so that it could be used later. In fact, the *constant(* function is used internally by the convertvariablestoconstants statement for just this purpose.

**See Also**

- constantvalue( -- converts a field or variable into an equivalent constant value.
- datatype( -- determines what kind of data is in a field or variable: text, number, etc.
- expressiontype( -- determines what kind of data is generated by an expression: text, number, etc.
- info("datatype") -- returns the data type of the current field.

**History**

Version | Status | Notes |

10.2 | New | New in this version. |