4D v16

Filter expressions contained in a 4D Write Pro document

Home

 
4D v16
Filter expressions contained in a 4D Write Pro document

Filter expressions contained in a 4D Write Pro document  


 

4D Write Pro documents can contain references to dynamic 4D expressions such as variables and fields, but also formulas, project methods, or 4D commands. These references are evaluated when the documents are displayed or printed. For security reasons, evaluation of dynamic expressions must be controlled by the developer to make sure that no inappropriate expression is used and that it will not generate any unexpected changes or side effects in the database. This prevents you from executing commands such as DELETE SELECTION or methods like "DeleteOrders".

Note: Expressions can be inserted using the ST INSERT EXPRESSION command, or by editing 4D Write Pro documents with an HTML editor.

Starting with 4D v16, evaluation of 4D commands and project methods inserted in 4D Write Pro documents is now under the control of the regular 4D filtering option defined at the database level. This option is located on the Security page of the "Database Settings" dialog box:

By default in 4D, this option is Enabled for all, which means that commands and methods must be explicitly allowed; otherwise evaluation errors are returned. You can disable this filtering partially (for the Designer and the Administrator), or for all users. This option is used in the entire 4D database and controls all user formula evaluations. For more information about this option, please refer to the Design Reference manual.

When the option is enabled:

  • users can only call commands belonging to the "formula compliant" list. This list is displayed in the right-hand part of the Formula editor:
  • users cannot execute any project method. Project methods that you want to allow in 4D Write documents must be explicitly declared using the SET ALLOWED METHODS command.

Whenever a "forbidden" 4D method or command is found during the evaluation of an expression in a 4D Write Pro document, the value is replaced by " ## Error # 48".

Example  

You inserted the following expression in your 4D Write Pro document:

 ST INSERT EXPRESSION(*;"WriteProArea";"Gender")

By default if the security option is checked, the Gender method will not be evaluated:

If you execute the following code:

 ARRAY TEXT(aTallow;1)
 aTallow{1}:="Gender"
 SET ALLOWED METHODS(aTallow)

The Gender method will be evaluated and return a value:

This filtering was not enabled for 4D Write Pro documents in previous releases. If your 4D Write Pro documents were referencing 4D methods, they will no longer be evaluated once the database has been converted to 4D v16 or higher. "## Error # 48" messages will be displayed instead.
In this case, you need to add the methods to the approved list using the SET ALLOWED METHODS command.



See also 

Download HDI database

 
PROPERTIES 

Product: 4D
Theme: Filter expressions contained in a 4D Write Pro document

 
HISTORY 

New
Created: 4D v16

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v16)