KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: User Defined Constants and Compiled Applications
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: April 21, 2011

One of the great components in the 4DPop collection is the 4DPop Constants component. This component makes the creation of predefined constants for use throughout the application very easy. Having predefined constants adds consistency, speed, and self-documentation to the coding of the application.

The 4DPop Constants component does this by creating a plug-in named "User Constants" and places it in the Plugins folder of the database. Once made that plug-in can be used in the development any other application.

A key term mentioned above is "development." As long as the application runs in interpreted mode, it is necessary to have the "User Constants" plug-in in the Plugins folder. However, once compiled the plug-in is no longer necessary because the actual values of the constants are transferred from the plug-in into the compiled code.

This means that when distributing a compiled database, especially for a compiled server, the "User Constants" plug-in can be removed from the Plugins folder, thus reducing the number of files transferred to the remote cache whenever a user logs on to the server.

Commented by David Lieb on April 22, 2011 at 6:16 AM
One caveat: you will still need to include the User Constants plug-in with the compiled database if an end-user might reference the constants from some place other than the compiled code, e.g. via a Quick Report or the Formula Editor.