4D Blog

Home Product Use methods and database fields in 4D View Pro

Use methods and database fields in 4D View Pro

July 23, 2018

Product

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. 

HDI: Use methods and database fields in 4D View Pro

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.

    ARRAY TEXT
    ($allow;0)
    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.

    ARRAY TEXT
    ($field_Titles;0)
    ARRAY LONGINT($field_Num;0)
    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.
    C_TEXT($0)
    $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.

Fields auto-completion

blank

Method auto-completion

 

 

 

Discuss

Tags 4D View Pro, Spreadsheet, v17 R2, v18

Latest related posts

  • July 18, 2025

    Embed deployment license automatically into your applications

  • July 17, 2025

    New Class to Perform UDP Communications

  • July 17, 2025

    Managing Calendar Events with Microsoft 365 or Google in 4D: Create, Update, Delete

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R9 20 R10 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R9 20 R10 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy