This document is a compilation of all features available in 4D v17, that were introduced either during the v16 R-release program or in the very last step from 4D v16 R6 to 4D v17. Note that each feature has a related blog post to walk you through concrete examples. These blog posts can be accessed by clicking the feature’s title.
Also consider that sections with the label are related to all the new released features between 4D v16 R6 and 4D v17.
This document is divided in seven sections:
4D v17 introduces an innovative concept to allow you handle your database with an object oriented approach: ORDA (Object Relational Data Access).
Here are the features we are shipping with this release:
With ORDA, CRUD (Create, Read, Update and Delete) operations can be performed on your database through an abstraction layer: the datastore, which is an object that provides an interface to the database model and data through objects. With ORDA, the Create, Update and Delete operations are not performed on a current selection or on a current record but on entities:
- Create: it can be achieved by instantiating a new entity with the new() method and then saving it with the save() method.
- Update: performed on an entity using the same save() method.
- Delete: performed on an entity or an entity selection using the drop() method.
With ORDA, the datastore is an object that provides an interface to the database model and data through objects. Also you don’t handle current selection for each table and current record anymore, but rather entities that are objects. You can easily query several linked tables, manage recursive relations on a same table, as well as using several logical operators in a single query. 4D v17 provides several ways to allow you query your dataClass (i.e. table): you can either provide the query as a single string, or provide the query and values separately using placeholders, or provide the query and values separately using a collection built dynamically. Read documentation
ORDA can be integrated with your existing code! It’s possible to update the current selection of a table from an entity selection as well as getting an entity selection from the current selection of a table! New commands are added for this purpose: USE ENTITY SELECTION command to update the current selection in the corresponding table, and the Create entity selection command to get an entity selection related to the corresponding DataClass. Read documentation
With ORDA you can separate entities and entity selections from the database to work on them separately. Also, you can move existing objects and collections to the database. So in order to export an entity to an object, use the toObject() method; and toCollection() method in case you want to export an entity selection to collection. And importing an entity via object can be done thanks to fromObject() method and importing an entity selection via a collection can be achieved with fromCollection() method. Read documentation
ORDA provides simple methods to create and add entity selections, as well as methods to navigate through entities in an entity selection object, which will allow you to handle several entity selections at the same time and navigate through them independently. An entity selection is created using the newSelection() method, and entities are added to it with the add() method. An entity selection provides first() and last() methods to get the first and last entity, and an entity provides previous() and next() to get the previous and next entity. Read documentation
Logical operators can be used on entity selection, allowing you to get the intersection, union, or difference between two entity selections as with sets in classic language. Read documentation
ORDA provides a great feature to pipeline the data through filters and get aggregate values, it does afford a set of aggregation operations that examine and perform calculations on the data sets. For instance, sum(), average(), count(), min() and max() methods are used to perform operations that their names describe! Read documentation
Here are the biggest improvements we brought to the 4D language to make your coding experience much easier and more intuitive:
Object notation feature changes drastically the way you write code and use the database engine, your coding is made faster and easier to understand. For example you can simply write $myobject.attribute.subattribute:=5 or access an attribute with $person.children.firstname, also you can use object notation as expression. For example create a form object like a text variable and assign directly the object attribute, e.g. [person]relatives.grandfather.grandfather.firstname. It is no longer needed to use OB Get recursively to read the value and assign it to a temporary variable, just to display it. One of object notation perks is the use of undefined properties and values, because 4D language now accepts undefined values anywhere in an expression. And, whenever you assign an undefined value to a variable, it will be set to a default value according to its type.This means that reading the property of a non-existing object will neither generate an error nor stop the code execution. Read documentation
Shared objects and shared collections are an easy and efficient way to share information between preemptive processes. Shared objects and shared collections behave just like standard ones, except they must be declared as “shared” during their instantiation with the following new commands: New shared object and New shared collection. Once instantiated, they can be used directly, just like any other variable, for reading. And for writing or modifying, they must be surrounded by the Use and End use keywords. Read documentation
New loop has joined the 4D language: For each / End for each, to allow you iterating over advanced data types such as collections and there is no need to have advance knowledge of how many items belong to the collection before entering the loop. It can also be used to iterate over object properties. This is useful if you want to write some generic code, without knowing the object property names in advance. Read documentation
Collection is new a type added to the 4D language. Collections are flexible and it can speed up your development time. On the first view a collection looks like an array, but while an array is a highly optimized list of the same type (Array longint, Array Text, …), a collection is a kind of container storing a list of individual types (a longint, then a text, then a number, then a picture, an object, even another collection, etc); and it can be accessed with object notation. The New collection command creates a new empty or pre-filled collection. And in order to ease the manipulation of collections, a bunch of new methods to be used with Object Notation are provided. These methods allow, for instance, to add or remove elements, sort the collection, and much more. Over 40 new methods are already available. Here are just a few of them: pop(), push(), concat(), resize(), query(), slice(), … Read documentation
The new Null command can be used to check if an object attribute or a collection member has an unknown or missing value (mind the difference from the value 0 or an empty string “” with an unset value). It also allows to set an attribute value to unknown. This command can be used with object notation. Read documentation
Develop with objects
Dates can be now be set as dates and not strings in an object, making the use of dates inside objects easier and more intuitive. Thus OB SET and OB Get can be used without requiring the is date constant, and the object notation can applied to them like any other typical object. In order to use dates inside objects, just check the “Use date type instead of ISO date format in objects” option from the compatibility setting page in Database Settings. Read documentation
Pictures can now be stored in an object field or in an object variable. The OB Get and OB SET commands support the new Is picture type and to be able to store a picture in an object field. And object notation can be used as well. Read documentation
A new option has added to help you reduce your debugging time when parsing JSON strings. The option * parameter of JSON Parse creates additional debug information (__symbols property) which provides path, line position, and line offset of each property and sub-property of the object. Even if an object is well formed, it might not fulfill requested specifications or content norms. The new JSON Validate command allows you to check if the structure of the object fits to a given specification (JSON schema). Read documentation
It is now possible to search in an array inside an object using linked arguments. The QUERY BY ATTRIBUTE command allows the execution of complex queries inside a list of elements in a single object. When searching in array attributes with multiple query arguments joined by the AND operator, you’ll have the option to choose to get the records where matching arguments are in at least one element or in the same element. Read documentation
Preemptive multi-threading allows your application to take full advantage of multi-core computers. As a result, your applications run faster and can support more connected users. More than twenty existing commands have been enhanced so they can be used in preemptive processes. Read documentation
It’s now possible to create and use dynamic forms. Stored in a text-based format (JSON), they are opening a wide list of new opportunities: creating forms fully adapted to the end-user context, share the same form among several databases. The textual description of the form can be saved in a 4D object or a file. Then at runtime, the forms can be loaded. The following commands have been enhanced so that a 4D object or JSON file path can be passed: Open form window, DIALOG, FORM SET INPUT, FORM SET OUTPUT, OBJECT SET SUBFORM, OBJECT GET SUBFORM, FORM LOAD, Print form. Read documentation
Get rid of your complex code and global variables by binding an object to a form and use it internally with the new Form command. All you need to do is pass parameters in an object to a form using the DIALOG command. Any property of this object will then be available from within the form via the Form command. This also valid for subforms. Read documentation
Standard actions – such as First Record or color?value=red – can be assigned to a button or a menu item in the user interface or by programming. One of the benefits, is that 4D also automatically handles the menu item or button deactivation whenever the action is not applicable. In addition, two new commands have been added to 4D language to easily handle standard actions by programming:
- INVOKE ACTION can be used to trigger any standard action, optionally in the target context (current form or main form).
- To know if a standard action is applicable and valid in the current context, you can use the Get action info command.
4D 64-bit includes a fully optimized cache manager based on a automatic priority management mechanism for objects in cache memory. Full control over priority is given to handle of the objects in cache memory allowing advanced fine-tuning.
For advanced usage and specific cases, you can customize the cache priorities using two sets of 4D commands:
- Priority definition for the whole session and all processes: SET TABLE CACHE PRIORITY, SET INDEX CACHE PRIORITY, and SET BLOBS CACHE PRIORITY.
- Priority adjustment for the current process: ADJUST TABLE CACHE PRIORITY, ADJUST INDEX CACHE PRIORITY, and ADJUST BLOBS CACHE PRIORITY.
4D v17 takes a giant leap forward in security matters with the enhancements below:
For more details on the built-in tools and techniques involved in creating a secured environment for your business applications, please check out our Security Guide.
It’s now possible to get the A+ ranking (highest rate) from SSL Labs for your web sites, by simply activating HSTS (HTTP Strict Transport Security) feature on your 4D Web server! HSTS allows web servers to declare that browsers should only interact with it via secure HTTPS connections. Once activated, 4D Web server will automatically add HSTS-related information to all of your response headers. When a browser receives the 4D Web server’s initial response with the HSTS information, it will record it. From that point on, any future HTTP requests will automatically be transformed to HTTPS. And you can specify the length of time for the browser to store this information with the Web HSTS max age option. Read documentation
4D Web Server’s default security has been increased by supporting Perfect Forward Secrecy (PFS). This implementation provides your application with a better compliance for some networking security features, as well as a higher ranking on web security audit tests. PFS is automatically enabled when TLS is activated on the server. The WEB Get server info command can be used to make sure that PFS is enabled. The value of the perfectForwardSecrecy new attribute is true whenever all conditions needed to use PFS are met. Keep in mind that the RC4 algorithm is deprecated now in 4D Web Server as a result of some known security issues. Read documentation
4D supports Transport Layer Security (TLS v1.0, TLS v1.1, and TLS v1.2) to enable encrypted communications between clients and servers. The default minimum supported version is TLS v1.2, older versions will be rejected as they could be insecure. But if you want to support older browsers (or tools) that don’t support TLS v1.2, you can decrease the security level with the new Min TLS version selector for the Get database parameter and SET DATABASE PARAMETER commands. Read documentation
The hashing mechanism is ideal to store passwords. Two new commands have been created to generate and verify hashed passwords: Generate password hash and Verify password hash. Both are based on the bcrypt algorithm, which is slow by design. Thus, brute force attacks are slower and impacts are minimized. Read documentation
The digest functions are handy when it comes to data integrity checks during data exchanges or comparisons. The Generate digest command has been enhanced to support SHA-2. It now supports two algorithms of the SHA-2 family: SHA-256 and SHA-512. The syntax remains the same, and the SHA256 digest and SHA512 digest constants have been added. Read documentation
To protect your data from damage, the “Restore last backup if database is damaged” option from the “Backup” page of Database Settings is checked by default for new databases, which provides you with the best level of protection. Read documentation
4D Write Pro
You can now create multi-column documents with 4D Write Pro as well as converting your existing 4D Write documents containing multiple columns.The WP SET ATTRIBUTES and WP GET ATTRIBUTES commands have been updated to support new attributes to manage columns:
- wk column count: define the number of columns for the document or the section
- wk column spacing: define the spacing between two columns
- wk column rule style, wk column rule color, wk column rule width: define the vertical column separator’s style (dotted, dashed, etc.), color or width.
A new command, dedicated to 4D Write Pro is now available: WP Get position. Given a specific range, element, or reference, this command returns an object variable with five important data information at once: the section number where the range begins, the page number, the column number, the line number, and even the position of the first character of the range in the line. Read documentation
The WP Get elements command returns a collection of elements of any type (paragraphs, tables, images, etc. If a typed range is passed, the command will return a collection containing only elements of the corresponding type (unless specified in the second parameter). Otherwise, the command returns a collection containing all of the available elements, no matter its type. Read documentation
The WP SET TEXT command allows you to write text at any position inside a document. This command is used the same way as most of the “Insert” commands in 4D Write Pro. It takes three arguments: the range object (where the text should be inserted), the text itself, then a constant to define if the text should be placed before, after, or replace the range. Read documentation
Tables arrive in 4D Write Pro! Real tables, individual cells, if you enter a large text in a cell, the text will be automatically wrapped, and the cell width will just remain the same. You can create a table from scratch and modify the style of the table, or its columns, rows and even individual cells, all this by programming.
The WP Insert table command allows you to create a table with a number of cells, rows or empty. The following commands have been created to allow you to manage tables in your 4D Write Pro document: WP Table append row, WP Table get rows, WP Table get columns, WP Table get cells. All these new commands are thread-safe. Read documentation
Easily create your custom 4D Write Pro toolbar, without any programming. The standard actions mechanism, simple but very powerful, has been extended so it can also be also assigned to check boxes and pop-up menus.
Using standard actions makes you take advantage of automatic mechanisms which will save your time: the object activation/deactivation is automatically handled by 4D depending on the context and the current status (for check boxes) or value (for pop-up menus) is automatically updated according to the current text selection. Read documentation
4D Write Pro and pictures handling
Full control over picture insertion at a specific position is given: in front of or behind text, as well as anchored to the page or specific parts of the document (i.e., header, footer, sections). The WP Add picture command adds the picture to the page, then to define its exact position as well as other properties, you can either use standard actions, or use the set of selectors that have been added to WP GET ATTRIBUTES and WP SET ATTRIBUTES commands. Read documentation
4D Write Pro now supports picture expressions. The ST INSERT EXPRESSION command has been expanded to support any expression returning an image. An expression can be a 4D variable, field, function, or a user-defined method. Keep in mind that before using a 4D method in an expression, you first need to enable the usage of this method using the command SET ALLOWED METHODS. Read documentation
Creating background pictures filling the whole page is possible with 4D Write Pro, thanks to a background style attribute for image clipping and origin. This attribute can be controlled via:
- 4D language: You can use the WP SET ATTRIBUTES command and set the new wk paper box value for background picture clipping and/or origin.
- Standard actions: The INVOKE ACTION command can be used, or in design mode as any other standard action.
- 4D Write Pro widget: When selecting the “background picture” and “document” items, the clip and origin options will have a new paper box option available.
4D Write Pro headers and footers can be managed programmatically to create other documents based on a template, thanks to new commands, divided into two categories:
- Commands to get references of any header, footer or body inside documents, which can be used to get associated ranges, create documents for a specific section: WP Get header, WP Get body and WP Get footer.
- Commands to move the cursor to a specific position: WP Get frame is used to get a reference to the frame where the cursor is currently located, while WP SET FRAME sets the cursor into a specific frame.
You can add a link to your company logo or company name with wk link url attribute. Hyperlinks can be added on pictures, text or a combination of both, just by using WP SET ATTRIBUTES and WP GET ATTRIBUTES commands. Read documentation
4D Write Pro provides an additional functionality to fine tune your design: leading characters (e.g.the repeated dots or any other character in a table of contents for instance). Leading characters can be controlled either from the contextual menu when you click on an existing tab in the ruler area, or programmatically thanks to the wk tab stop leadings new selector and the WP SET ATTRIBUTES command. Read documentation
Use the horizontal ruler in a 4D Write Pro area to adjust margins, indents and align horizontally text, graphics, tabs, and other elements in your documents. Read documentation
First step toward converting your existing 4D View documents to 4D View Pro is up and running. Thanks to the VP Convert from 4D View new command, most properties and information stored in 4D View documents are automatically converted, including document structure, values, formats, styles, borders and formulas! Read documentation
Thanks to the new 4D View Pro form object, and the new 4D View Pro commands, you can now create 4D View Pro spreadsheets. Create a new document with VP NEW DOCUMENT, save it on disk with VP EXPORT DOCUMENT or in the database using VP Export to object and reopen it with VP IMPORT DOCUMENT or VP IMPORT FROM OBJECT. Read documentation
4D View Pro supports automatic variable row height, meaning that a list box adapts the height of each row to its content so the full text or picture can be displayed avoiding all kind of wrapping issues. Three new properties are available in the Property List: Automatic Row Height, Min Row Height and Max Row Height. These settings allow developers to define whether a list box uses the automatic row height mode, in addition to the minimum and maximum row height allowed.
These settings can also be managed programmatically using the LISTBOX SET PROPERTY command and the new LISTBOX SET AUTO ROW HEIGHT command. Read documentation
The Get system info command retrieves all of the hardware and system details for the running machine and information that includes: which OS is being used, which processor(s), how much RAM is available, and more. Read documentation
The WEB Get server info command retrieves detailed information about your 4D Web server. This command has an optional input parameter, withCacheInfo, which is useful if the web server cache information is needed. This attribute is set to “False” by default. Read documentation
The Get process activity command gives a snapshot of connected user sessions, related running processes and of all current processes including internal processes that were not reachable by the PROCESS PROPERTIES command. In addition, a systemID attribute is included to uniquely identify any process: user, 4D, and spare. You can also compute from the session/process information returned the CPU time consumed by this process since connecting (in seconds) and the activity percentage (e.g.: 2%). On the top of this, the command makes parsing the results easier. Read documentation
Two commands have been created to ease the management of file and folder paths. The Path to object command returns an object containing the specific properties (parent folder, file or folder name, file or folder extension) of the path you passed in parameter. The Object to path command builds a path from the object attributes passed in parameter. So, to compose a new path, modify the object attributes you need and just recombine them.
These commands should now be used in place of the _o_Document type and _o_SET DOCUMENT TYPE deprecated commands. Read documentation
The Get 4D file command has been enhanced for a better access to log files. Now you can easily find a particular log file instead of getting the folder containing all the logs. A set of new selectors have been created for this command: Request log file, Debug log file, Backup log file, Verification log file, Compacting log file, Repair log file, HTTP debug log file and Build application log file. Read documentation
The method editor has been enhanced to provide code completion for object attributes. A list of suggested attributes is being displayed, whenever a dot character is typed after an object, to improve the coding velocity and avoid mistakes or typos. The autocomplete behavior can be customized from the “4D preferences” panel, to define whether the suggestion list will be automatically opened after typing a dot character (option checked), or only after using the tab key (option unchecked). Read documentation
The whole 4D Windows 64-bit product line is no longer relying on the Mac2Win library from Altura. 4D Server Windows 64-bit was the last step to complete and this is done with 4D v16 R4. This is allowing 4D to internally use modern technologies on the Windows platform, and make you benefit from new features such as SDI. Read documentation
4D Windows application used to have a grey main window (named MDI – Multiple Document Interface) with all application windows displayed inside (as child windows). SDI (Single Document Interface) applications have a main window that can open many additional windows which are independent of the main window. They can be moved on other screens, they stay visible even if the main window is hidden and so on… Why 4D now allows both modes on Windows 64-bit for merged applications. Read documentation
You can disable or enable by programming all help tips inside a 4D application using SET DATABASE PARAMETER command. You can also define the display delay and the maximum duration of the display by language. But that’s not all, it’s also possible to dynamically modify the text of a help tip using the OBJECT SET HELP TIP command. On top of that, the LISTBOX GET CELL POSITION command now supports two new optional parameters (x and y position, in pixels) and returns the corresponding column and row numbers, to help you display tips on a column, row or particular cell of a list box. Read documentation
Define the object input order in a form by programming, so you can control on which next form object the focus will be when the user presses the TAB key. Two new commands – FORM SET ENTRY ORDER and FORM GET ENTRY ORDER – allow you to dynamically set and get the entry order of the current form objects for the current process. Read documentation
The UI has improved for a better user experience for users with IPv6 network configurations. Read documentation
The “find in design” dialog has been empowered with two new functionalities related to the result window. A new button has been added to allow interrupting an on-going search. Furthermore, a new filter option is available so that you can select the result items that you want to keep and remove all other items except this selection. Also, the results of a “Find in Design” operation are displayed in a hierarchical list. You can also now export the search results to a text file that can be opened later in a spreadsheet for example, allowing you to easily share or store the results. To do so, just select the Export Results new item, available in the “Find in Design” action menu. Read documentation
It is now possible to have detailed control over the highlight color, for every single line or even cell. For this matter a new option has been added to the list box property list: Hide selection highlight. When this option is checked, the developer needs to make list box selections visible using available interface options. Then they can define a specific background color, font colors and/or font styles by programming to customize the appearance of selected rows. This can be done using arrays or expressions, depending on the type of list box being displayed (selections or arrays). Read documentation
On macOS Sierra, applications now have the opportunity to use tabbed windows instead of multiple windows. 4D Developer Edition 64-bit can now take advantage of this Apple’s new feature in the design environment thanks to the new Window tabbing option available in 4D Preferences. When the new preference is active, Method and Form Editor windows can be combined into a single window with tabs. Read documentation
Quick Report 64-bit editor now supports cross-table reports in addition to list reports allowing your end-users to appreciate the smooth user experience upon designing reports. Choosing the cross-table mode allows you to display your report as a Pivot table. Note that reopening an existing report created with the 32-bit 4D products is still possible. Read documentation
For both a better user experience and improved support of new HTML features, 4D is updating its internal component for embedded Web Area objects in 4D 64-bit to Blink (also used by Google Chrome). Blink is the most up-to-date and well-maintained existing rendering engine. The switch to the Blink framework doesn’t require any code change for your application and has strictly no impact in the Web area usages; all commands and events for embedded Web Areas work the same as before, except few preferences which are not supported and are ignored. When the Use embedded Web rendering engine option is checked, 4D uses WebKit on 32-bit versions and Blink on 64-bit versions. Read documentation