4D v16.3EXECUTE FORMULA |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
EXECUTE FORMULA
EXECUTE FORMULA
EXECUTE FORMULA executes statement as a line of code. The statement string must be one line. If statement is an empty string, EXECUTE FORMULA does nothing. The rule of thumb is that if the statement can be executed as a one-line method, then it will execute properly. Use EXECUTE FORMULA sparingly, as it slows down execution speed. In a compiled database, the line of code is not compiled. This means that statement will be executed, but it will not have been checked by the compiler at compilation time. Note: Executing formulas in compiled mode can be optimized using a cache (see Cache for formulas in compiled mode below). The statement can include the following elements:
The formula can include process variables and interprocess variables. However, the statement cannot contain control of flow statements (If, While, etc.), because it must be in one line of code. To ensure that the statement will be evaluated correctly regardless of the 4D language or version used, we recommend using the token syntax for elements whose name might vary between different versions (commands, tables, fields, constants). For example, to insert the Current time command, enter 'Current time:C178'. For more information about this, refer to Using tokens in formulas. For optimization purposes, each formula executed by EXECUTE FORMULA in compiled mode can be stored in a dedicated cache in memory. The formula is cached in tokenized form. Once it is placed in the cache, its subsequent executions are highly optimized since the tokenization step is bypassed. The cache size is zero by default (no cache); it needs to be created or adjusted using the SET DATABASE PARAMETER command. For example: SET DATABASE PARAMETER(Number of formulas in cache;0) //no cache for formulas The EXECUTE FORMULA command uses the cache only when called from a compiled database or component. You want to execute formulas including calls to 4D commands and tables. Since these elements could potentially be renamed, you can ensure correct execution in future versions of your application by using the token syntax as shown here: EXECUTE FORMULA("Year of:C25 ([Products:5]Creation_Date:2])+$add")
See also
|
PROPERTIES
Product: 4D
HISTORY
Modified: 4D v11 SQL ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||