KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to use Project Methods in 4D View Pro
PRODUCT: 4D | VERSION: 17 R | PLATFORM: Mac & Win
Published On: August 30, 2018
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Starting with 4D v17 R2, project methods can be used in 4D View Pro as part of the formulas and can even receive parameters to perform complex functions and return values to display.

To use a method in the formula the method must:


Be allowed to be used by the user.
This can be done in two ways, through the database setting which will allow all methods to be accessed if the Formula filtering option is set to "Disabled for all"



If the filter is enabled for the users then the SET ALLOWED METHODS command can be called to allow specific methods to be used.
Note: The allowed methods are also shared with the formula editor, 4D Write Pro, and the 64-bit label editor.

Be executable in the current database
This means that the method should belong to the host database or if it is from a component, it must be shared.



Not share the same name as a 4D View Pro function
4D View Pro has a set of functions such as SUM(). If a project method SUM is created and attempted to be used the 4D View Pro's function will be used instead.

Be ECMA compliant
The name must comply with ECMA script standards, such as space characters not being allowed to be used as part of the project method's name.

To use a method as a function:


If all of these requirements are met the method can then be called in a 4D View Pro area cell through use of a prefixed equal symbol (=) to let the area know a function is being called followed by the method name and then a pair of parntheses are needed even if there are no parameters.

Example of calling a method named viewProFunc in a 4D View Pro cell:
=VIEWPROFUNC()