KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Allowed methods and Formula Editor performance
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: October 12, 2007
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

4D 2004 added the ability to exclude methods from the Formula Editor (so that users cannot do things like execute your wrapper for QUIT 4D). A side-effect of this is, of course, that a list of allowed methods must be built when you open the Formula Editor. Obviously, this list takes some time to build. If a database contains several thousand methods there can be a noticeable delay when opening the Formula Editor.

In 2003 the list of methods in the Formula editor is just a "dump" of all the methods in the database with no processing, so it appears that opening the Formula Editor is faster in 4D 2003.

You can verify this by doing the following before opening the Formula Editor (in 2004):

ARRAY TEXT(aa;1)
aa{1}:="*"
SET ALLOWED METHODS(aa)


Doing this tells 4D that only methods that are named "*" (which obviously do not exist) can appear in the Formula Editor. This makes the Formula Editor open as fast as in 2003 (if not faster). The more methods allowed, the slower it gets.

The great thing about this feature is, obviously, the ability to limit the methods that users have access to. This should really be implemented in any database that uses the Formula Editor. Once the list of allowed methods has been set, the performance of the Formula Editor should be acceptable.

Note that there is a Preference for when you are logged in as Designer and Administrator that overrides the above code. It is under Application | Compatibility, "Always allow all commands and project methods in the Formula editor". This needs to be turned off in order to limit the list for Designer and Administrator.