With 4D v17 R2, it’s now possible to call 4D project methods and fields from within your formulas. This not only extends the possibilities of your 4D View Pro documents, but as the conversion process is continuously improved, calls to 4D methods and fields in converted 4D View documents are also preserved.
4D View Pro provides you with improved security to protect your database, too. As a developer, you have full control over the data you choose to make available (or not) to your end users, as well as which field or method allows the access. Commands and variables can’t be called directly from a cell, but rather through allowed methods which return the command or variable value.
Any access to data or commands must be authorized by the developer:
- Methods can be authorized with the SET ALLOWED METHODS command, as shown in the example below.
APPEND TO ARRAY($allow;"get_LicenceInfo")
APPEND TO ARRAY($allow;"get_SystemInfo")
SET ALLOWED METHODS($allow)
- Tables or fields must be declared as virtual structures with the SET TABLE TITLES and SET FIELD TITLES commands.
APPEND TO ARRAY($field_Titles;"Name")
APPEND TO ARRAY($field_Titles;"Ingredients")
APPEND TO ARRAY($field_Num;2)
APPEND TO ARRAY($field_Num;3)
SET FIELD TITLES([Recipes];$field_Titles;$field_Num;*)
- Variables and 4D commands must be contained in an allowed method.
$0:=Get system info.accountName
Note that when converting an existing 4D View document which contains database fields, the database must still exist and the virtual structure should be declared in the conversion base. Also, existing commands or variables in the document will appear as an error in the cells, indicating that they need to be called through methods.
Methods and fields auto-completion
It’s worth mentioning that auto-completion of methods and database fields is supported. Once the user starts typing, a list of available methods is suggested which enhances the user experience by reducing the amount of typing required. The same goes for database fields, a list of allowed fields are listed when typing in the following syntax, TABLE_FIELD.