KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Variables and the 4D Transformation Tag 4DEVAL
PRODUCT: 4D | VERSION: 15 | PLATFORM: Mac & Win
Published On: September 23, 2015

With the introduction of the 4D Transformation Tag 4DEVAL variables can now be created within a tag statement. Variables such as $Var_L, Var_L or <>Var_L are all legal variable names to use in a 4DEVAL statement. Develoers must be aware of how and when these variables are shared with current and other processes when interpreted or compiled.

Since 4DEVAL works as an interpreter and does not execute compiled code, variables do not have to be declared with a compiler command, 4D will type the variable based on the context in which it is first used. How variables are treated are consistent with how, where, and when variables are declared or populated.

<!--#4DEVAL $Var_L:=999-->
<!--#4DEVAL Var_T:="foo bar"-->
<!--#4DEVAL <>Var_D:=Current date:C33-->


•  Variables prefixed with "$" are local and are not shared outside the context PROCESS 4D TAGS execution.

•  Variables prefixed with "<>" are interprocess variables and are accessable in other processes. However...
    ••  If the database is interpreted, the variable is only defined "after" it has been populated within the call to PROCESS 4D TAGS.
    ••  If the database is compiled and used elsewhere with 4D code, the variable will be defined upon database startup.

•  Variables without a "$" or "<>" prefix are process variables are accessable within the process that calls PROCESS 4D TAGS but not in any other processes. Within the process calling PROCESS 4D TAGS...
    ••  In interpreted mode, if not previously declared or populated the variable is defined only after the call the PROCESS 4D TAGS.
    ••  In compiled mode, and used later within 4D code, the variable is defined at process launch.