This document is a compilation of all of the new features available in 4D v18. 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, sections with the tag are related to all the new features released between 4D v17 R6 and 4D v18.
This document is divided into seven sections:
Project database – Version control
A solution shipping with 4D v18 makes it easier for distributed teams to work collaboratively by storing the source code in a source control system using plain text files. It allows you to take advantage of the combined power of the 4D development platform with the versatility of lightweight and distributed files:
A project database contains all of the source code of a 4D database application, from the database structure to the user interface, including forms, menus, user settings, or any required resources. Since project databases are made of text-based files, projects contain multiple folders and files stored within a single parent database folder. When you create a project database, you’ll find many of the same folders as a binary database:
There are also two new folders:
- Project – Application source code (equivalent to .4db)
- userPreferences.<name> – Contains files of memorized user configurations (e.g., breakpoint positions, window positions, etc). Read the documentation
Convert an existing binary database
You can create a project database either by creating a new blank project database or by exporting an existing binary database (.4db) to a project folder. To convert an existing binary database, just click the File > Export > Structure to project menu item. Once that’s done, a message is displayed to inform you of the conversion’s completion. 4D also lets you know if any errors requiring your intervention have been detected. For example, in the case of older form objects that are no longer supported. Read the documentation
When it comes to the structure for a binary database, the description of your application is stored in two files (.4DB and.4DIndx). For a project database, you’ll find this description in the files stored in the “Project” folder. After conversion, you can remove the following files from the Project folder (if you want to): <database>.4db and <database>.4dIndy. The data for new project databases resides in a “Data” folder at the same level as the “Project” folder. Therefore, even during the development phase, a file located next to the Data folder is different from a file located next to the structure. We recommend that after conversion, you create a Data folder at the same level as the Project folder, and move the data.4dd and data.4DIndx files into it. Finally, to keep data separated and ease deployment, 4D now names files with the word “preferences” for development-related parameters, such as code editor configuration, while using “settings” for deployment-related parameters, such as memory or backup settings.
Managing users and groups
Because project databases are entirely text-based, there’s no longer a reason for users and groups management to protect the code. This role has been delegated to the version control system or to the OS file/folder access rights system. As a result, users and groups are now only used to handle data access. They are stored in a text file named “directory.json” beside the data file.
There is no longer a need to differentiate Developers from Users. Therefore, both now have the “User” type. In order to simplify deployment, the Get 4D file and File commands now accept the new Directory file constant, so you can easily and automatically handle the correct file. Read the documentation
During conversion and migration
The directory file will be automatically generated during the conversion process and placed next to the project settings. If you’ve thus far used the BLOB TO USERS command to restore your users and passwords, the command will now generate this directory file so you don’t need to modify your existing code. Read the documentation
Single user mode
In single-user mode, Users and Groups are completely disabled. The current user is always the Designer and can’t be changed. Users and groups access rights to the application can be delegated to the system. If you want to mask the Designer name with the system account or your own user name, you just need to call the SET USER ALIAS command. Read the documentation
In client-server mode, the Users and Groups are fully operational. You can change the current user, set an alias, change a password, etc.
The Users and Groups toolbox pages are accessible in all modes: single-user and client-server. However, in single-user mode, the toolbox can only be used to modify the users and groups that will be used in client-server mode.
Deploy your application
Deploying consists of two steps: code compilation and application creation. You can compile your project database in the same way as you compile your binary database (.4db). There is no difference. The interface is the same and the machine code produced is the same. The only difference is that the compiled result is saved in a binary file (.4db) for binary databases, and in the “Project/DerivedData/CompiledCode” folder for project databases. You don’t have to make any changes to create your applications (compiled database, component, stand-alone application, client/server application), you can use the configuration file of your binary database with your converted project database. The difference lies in the files generated: project databases have a file with the “.4dz” extension instead of a “4dc” file. Read the documentation
Upload to a source control system
When you compile your database, 4D stores the compiled code in the “Project/DerivedData” folder. It’s recommended to upload the “Resources” folder, the “WebFolder” folder and the “Project” folder (without the “DerivedData” sub-folder) to a source control system. Read the documentation
Style Sheets become CSS
The possibilities of style sheets have been dramatically enhanced. 4D was inspired by the grammar and syntax of CSS for project database style sheets, adapting it to the specific needs of 4D forms. This allows you to configure form object properties with style sheets. Read the documentation
New, built-in data encryption for your 4D databases is now at your disposal. Data can be encrypted via code or the user interface, for all tables or only selected tables. 4D’s encryption tools are based on a passphrase. It’s composed of a sentence or a combination of words which is used to generate a binary encryption key to encrypt data with the AES algorithm. In order to work with an encrypted data file, the passphrase or the binary encryption key is mandatory. 4D encrypts data on the file level, meaning your data file (4DD), your backup, and your journal is encrypted. In addition to security on your own computer, this renders copying backups to the cloud or external disks much safer, since the data stays encrypted.
A new Encryptable attribute is available for tables in Design Mode. It sets the encryption status of a table by designating that it is able to be encrypted. Once you’re ready to encrypt your data, the easiest way to do so is via the new Encrypt page in the MSC. This page provides all of the necessary features to monitor your data encryption. You can use this page to encrypt or decrypt the data file, as well as re-encrypt it and/or change your passphrase. Read the documentation
In addition to the MSC, 4D v18 includes a set of commands that are designed to support most encryption requirements. For example, you can manage encryption with the Encrypt data file() command, or use the provideDataKey() command to provide the data encryption key to an opened data file. You can even use the encryptionStatus() command to check whether or not the opened data file is encrypted and if a valid data encryption key has been provided. The complete list of commands is available in the Doc center. Read the documentation
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.
4D for iOS
4D for iOS is a solution allowing you to extend your business applications to mobile devices. 4D for iOS is fully integrated into 4D so there’s no need for any additional installation (except Xcode) or any prior expertise. Here are the features we’re shipping with this release:
Editing data directly from your app is now possible thanks to actions. This means that your users can edit data directly in your iOS app. To protect your business logic, each “action” is sent to 4D and executes your 4D methods to check, calculate additional data, and finally approve or reject the user entry. Also, predefined actions have been provided to manage your app content: Add, Edit, and Delete. Read the documentation
Data formatters, a newly introduced concept that allows you to define specific data types for your fields in order for the content to be displayed in the correct format. You can quickly override your fields’ default format to display the format of your choice, such as currency, boolean, percentage, dates, and much more. For example, imagine you want to display a picture to visualize “paid” and “unpaid” invoices but which would fit much better on the iPhone rather than a plain checkbox. Read the documentation
4D for iOS now supports multi-criteria search! After selecting your list form template, drop multiple fields into the search area to activate the multi-criteria search. When specifying multiple values for the same field, an OR operator is used behind the scenes. For example, drag Company name, Last name, and City into the search area to allow your user to enter any of this information to search for a customer. Read the documentation
Another newly introduced concept: Restricted queries. They allow you to filter the data to be synchronized with your mobile app. Limiting the data to only last year’s invoices, to only active customers, or only the region under a sales manager’s responsibility is incredibly practical and saves time synching data and a LOT of space on your iPhone. Read the documentation
Incremental data synchronization
Another interesting concept included in 4D for iOS is incremental data synchronization. It answers two different needs: even restricted queries could result in large data sets, so 4D now automatically keeps track of updated or deleted records and only updates this data on the device. Plus, your data is not only updated each time you launch your app, but also each time your app goes to the foreground or in response to a user action. Read the documentation
4D for iOS supports both N to One and One to N relation types. For N to one, it’s simple, you can use related fields in a form for the phone just as fields of the main table. For One to N relations, the form contains a button, which will switch to another page showing the list of related records, allowing the user to go back with a swipe. Read the documentation
Customize your app
Create your own list and detail form templates
4D for iOS already provides various lists and detail form templates to cover most of your needs. But you can also easily create your own templates. By using Xcode Storybuilder, you (or a colleague with Xcode skills) can create new templates or customize existing ones using all of the features iOS provides. To use the created template, no special skills are needed, you can use them as any built-in template. Read the documentation
4D for iOS has a large icon library covering many areas such as commerce, finance, education, government, health, industry, real estate, services, etc. Read the documentation
Create a custom data formatter
4D for iOS already includes basic data formatters for dates, percentage, time, etc., but you can also create your own data formatters and use them directly from the Project Editor. For example, you can create an integertoString formatter, which replaces internal numbers with names, such as shipping codes. Or integerToImage, to replace codes such as 1,2,3,4 with colored badges showing partner status. Read the documentation
4D v18 continues to bring enhancements to ORDA with the following features:
You are no longer limited to the current database, you can now access one or more remote 4D databases published on 4D Server(s). A remote database can be published as a REST resource and accessed from 4D clients. This remote database is usable (read/write) directly with ORDA concepts (which will trigger REST requests between client and server). TLS connections are, of course, supported. You can restrict access to targeted 4D users or develop your own access controls on the user’s credentials. Even though this process uses the Web Server to access the REST Server, a Web Server license is not required. Standard 4D Client licenses are used for connections. Read the documentation
New ORDA methods are available on the ds object to help you debug and optimize your ORDA code to gain a better understanding of sent requests. The startRequestLog() method is very flexible since, when called with a File object, it can log ORDA requests to a file or to memory. To stop logging ORDA requests, you can call the stopRequestLog() method. Read the documentation
With the help of formulas, you can now order an entity selection using complex criteria in a project method or in a 4D expression. The formula evaluates the order criteria which can be given in the form of a String or a Formula object to the orderByFormula() method. Read the documentation
Advanced queries using formulas
The query() method has been updated to support a Formula object as a parameter and return a new object of the EntitySelection type containing all of the entities found. This allows the creation of more sophisticated search criteria. Read the documentation
Performance optimization in client/server
Accessing large tables (especially those with relations) in Client/Server mode using ORDA has been greatly enhanced. When using entity selections in list boxes or in code loops (e.g., While or For each), the fields used will automatically be analyzed to optimize the network transfer. You’ll see 2-3x improved LAN performance and up to 30x faster in WAN (depending on the network and record size). And best of all – there’s no need to change anything in your code, it’s all automatic.
Methods to get the structure information
Many methods are available allowing you to get structure-related information (e.g., information about a table or field number). This can be helpful when integrating ORDA step-by-step into your classic 4D code. However, the main purpose of these methods is to give you a way to write generic code that’s applicable no matter the database’s structure. Read the documentation
Named placeholders for attribute paths
You can also use placeholders for attribute paths (fields names in tables). Two types are available: Indexed – inserted as :paramIndex (e.g. :1, :2,… with an increment of 1) in the query string and their corresponding values are provided by the sequence of value parameter(s), and Named – inserted by as :paramName and their values are provided in the attributes or parameters objects in the query string. Read the documentation
It’s now easier to write generic ORDA queries thanks to named placeholders for values. These placeholders are provided as object parameters in the query settings and replaced by another value when the query string is evaluated. Read the documentation
4D language & other programming features
A new way to create and send emails is available. The new functionality is easy to use – and also more powerful than before (using 4D Internet Commands). The new SMTP New transporter command allows the configuration of a new SMTP connection. Creating and sending emails follows three steps: creating your SMTP transporter, creating a mail object, then sending the email. A mail object has multiple properties: from, cc, bc, to, sender,textBody, htmlBody, to name a few. In addition, an attachment can be added with the MAIL New attachment command. Once created, the mail object can be sent with the transporter.send() command.
The SMTP New transporter command creates a connection between an SMTP server (such as Microsoft Exchange or Gmail) and the client, and logs – in plain, non encrypted text – of all of their communications. A new logFile property is available, containing the full path of the log file defined for the SMTP connection. The file can be produced in two versions: A standard version and an extended version. Both versions can be triggered by the SET DATABASE PARAMETER command. Read the documentation
Parse a MIME document, modify it, and resend it
The new powerful parser, MAIL Convert from MIME, converts a received email or a created MIME document from 4D Write Pro into an object. This allows you to edit or modify the object as necessary, such as change the subject, remove/add recipients, modify the body, add enclosures, and so on – and then send the document. For example: In the case you use 4D Write Pro to create HTML emails with static pictures in the text and you need to send it, here’s the process:
- Export your 4D Write Pro document in MIME format,
- use the MAIL Convert from MIME command to transform the MIME into an mail object,
- then send it via the SMTP New transporter command. Read the documentation
Enable Debugger in compiled and merged modes
Now you can use the 4D debugger to debug code in production mode, during the execution of the PROCESS 4D TAGS command via the TRACE command in code inserted between the <!–#4DCODE–> tags. Read the documentation
Build your own connection dialog to select the server
Now you can use a merged, single-user application to build your own connection dialog for a merged server. Read the documentation
The Form event command has been renamed to Form event code for clarity. This is because the command only returned the event’s code whereas a new FORM Event command, returns an object. There’s no need to change your code. The new command returns an object with multiple pieces of information. In addition to the event itself, it also contains information about the object triggering the event, such as its name and additional data depending on the object type. Read the documentation
Object notation to handle files and folders
Creating, modifying, or deleting files and folders on your disk became much easier and intuitive. A new Folder command has been added which lets you create a folder object from a constant, a POSIX path, or a platform path. The folder object has properties (e.g., name, modificationDate, modificationTime) and methods (e.g., create(), moveTo(), rename(), delete()) that enable the creation and manipulation of folders. As with folders, the File command is available to handle files. The new file object allows accessing and manipulating file attributes. You can use file methods to write and read the contents of a file, move it, delete it, etc. Read the documentation
You can compress or uncompress your files via code, without calling external libraries or tools. The new Zip Create archive command allows you to create a zip archive by passing either a file, a folder, or an object with parameters. And in order to decompress your archive, use the new ZIP Read archive command which returns an archive object that can be easily manipulated to obtain the list of files, extract a particular file or the whole archive. Using or creating a zipped archive works similar to the new File and Folder commands, keeping your code simple and easy to read. Read the documentation
Retrieve the current execution chain
A new Get call chain command is available to give you insight into the executed code. This helps you know where you are in your code, especially when one method calls other methods, which may then call other methods. The command returns a collection of objects with each object representing an execution step and describing its database, method type, method name, and call line. The command can be used in all code execution contexts, in both interpreted and compiled modes. Read the documentation
New tool to analyze debug logs
A new tool is available to help you to analyze the debug logs. For example, you’ll be able to see which processes are the most time-consuming, the call chain with its corresponding run time, and much more. This tool is designed to help you find conflicts in your code and improve the performance of your databases. Read the documentation
Headless 4D applications
You can now launch a 4D application without an interface (aka headless) via the CLI (Command Line Interface) with the new headless parameter. Available for all application types: 4D, 4D Server, standalone, remote, merged applications. Error messages or other dialogs are automatically fetched and redirected to a log file, avoiding stopping the server. Read the documentation
Disabling thread-safety checking locally
Now you can tell the compiler that a part of the code should not be checked for not-preemptive compliance, knowing that this part of the code will not be executed because it is part of an If or Case of statement and only executed in cooperative mode. To do this, you must surround the code to be excluded from thread-safety checking with the special directives %T- and %T+ as comments. The //%T- comment disables thread-safety checking and //%T+ enables it again. Read the documentation
Preemptive processes on 4D remote
Your processes can be run preemptively on 4D Remote, taking full advantage of the power of multi-core computers. Splitting an operation into pieces and running it on all available cores, in parallel, to get your results faster. Read the documentation
With all of the newly thread-safe commands, your applications can take full advantage of multi-core computers. Consequently, this results in faster responses to simultaneous requests.
The following 4D commands are now thread-safe: COMPRESS BLOB, EXPAND BLOB, BLOB PROPERTIES, ENCRYPT BLOB, DECRYPT BLOB,GENERATE ENCRYPTION KEYPAIR, GENERATE CERTIFICATE REQUEST, RECEIVE BUFFER, SET DEFAULT CENTURY, GET DOCUMENT ICON, TRANSFORM PICTURE, SVG EXPORT TO PICTURE, Get localized document path, Get database localization, LOCKED BY, LOG EVENT, Current client authentication, GET MEMORY STATISTICS. Read the documentation
Begin/End SQL in preemptive mode
Begin SQL, End SQL, and the associated SQL statements used with an internal database are now preemptive-compliant. Now, you can start all your requests in parallel and increase the speed of your applications if these commands are used to do a lot of asynchronous activity. Read the documentation
You can use, New signal – for example – to delegate work to a cooperative process in order to use a non-preemptive command. The command creates a shared object and allows you to manage the progression of the current process with two new methods: trigger() and wait(). Read the documentation
Call the onResize event on subforms
When a form contains one or more subforms, you can directly manage the on resize event in the subform method. This event will be triggered each time the size of the subform object is modified inside the main form. This may happen:
- When the main form is resized.
- When a splitter modifies the height or the width of the subform object.
- When a subform object size is modified by programming using OBJECT Set coordinates. Read the documentation
A new command is available to cast each specified variable as a Variant variable: C_VARIANT. The variant data type can be used to represent any other data type (BLOB, Boolean, Collection, Date, Longint, Object, Picture, Pointer, Real, Text, Time, Null, Undefined) except arrays. You can use the Type command to retrieve the type of the variable and Value type for the type of value. The Variant data type helps you to write generic code, such as allowing a method to receive a parameter as either text or blob, without needing to use a pointer. Read the documentation
Read 4D object fields with SQL engine
The SQL engine has been updated to allow reading 4D object fields. To browse the content of an object field, the SQL CAST function has been extended to return a JSON representation of the field. Read the documentation
4D products can already be launched using command line parameters to allow automatic testing or deployment. However, new parameters have been added to give you even more flexibility when opening your databases:
–opening-mode: will define opening your database in interpreted or compiled mode.
–create-data: will allow creating new data if the current datafile is not found or with a specific name if –data is passed.
–user-param: will send a string that can be read after the database is launched using the GET DATABASE PARAMETER command. Read the documentation
Define an alternate name for the 4D user account
A new command is available to define a custom name to use in place of the current 4D user account name: SET USER ALIAS. It accepts a string as a parameter. That string (alias) will replace the 4D user name in the 4D environment. An alias enables using your own user/password system, or an external user directory such as Active Directory or LDAP while still benefiting from all of 4D’s built-in user identification concepts. Read the documentation
Export a classic 4D form to dynamic form
A new FORM Convert to dynamic command is available allowing you to export a classic 4D form (stored in .4DB file) to a dynamic form. You pass the form name and receive an object describing the form. Then depending on your needs, you can change your form options such as the font size or the position of objects on the screen or even add more objects before displaying it. Read the documentation
The SET DATABASE PARAMETER command is enhanced to allow logging only specific processes, as well as calls to member methods (collection or object methods). A new selector is available (Current process debug log recording) which launches debug logging of the current process. Read the documentation
Dynamic forms and the entry order
Now, you can define an input order that is not necessarily associated with the z-order. For each page of your form definition, the “objects” attribute contains a list of form elements which are arranged following the z-order. A new attribute has been added to this list: “entryOrder”. It allows you to specify your own customized input order. If this attribute is undefined, 4D uses the z-order (i.e., the order defined in the “objects” attribute). Read the documentation
Running multiple clients on the same computer and simultaneously connect them to the same 4D Server is now possible. Each client connection now includes a separate cache folder containing the connection’s IP address, port, and hash code. Thanks to this, you can also connect several clients from the same machine to multiple servers on different machines. No configuration is necessary. Read the documentation
Write your own methods for objects
The New formula command is extended to allow you to create formulas as objects. You can pass parameters or access the contents of the formula object. Formulas as objects can perform calculations for object attributes to be passed to a method. Objects can now have their own callback or error handler. If you’re already using ORDA or doing classic selection-based coding, objects just became much more powerful. Read the documentation
4D Comment blocks
Comments can be on a single line comment or across multiple lines. Now instead of having many lines prefixed with //, you can simply use /* at the beginning of a comment and */ at the end to comment an entire block. You can also collapse and expand them. Also, the comments can be added to any part of a line, even inside an if condition or a loop. Read the documentation
SVG “non-scaling-stroke” attribute support
In the SVG standard, the “non-scaling-stroke” attribute indicates that the stroke width does not depend on the zoom or scaling. In other words, an object’s lines aren’t affected by transformations and zooming. Now, we’ve added new commands to the “4D SVG” theme. You can define the “non-scaling-stroke” attribute to drawing objects with the VG_SET_STROKE_VECTOR_EFFECT method. Read the documentation
4D Server administration commands
The list of commands that give you the ability to create your own administration interfaces as dialogs on the server, client, or even as HTML pages for web access, is completed:
- SEND MESSAGE TO REMOTE USER to send a message from the server to a remote user.
- Get process activity to retrieve a list of user sessions.
- DROP REMOTE USER to end a user session.
- ABORT PROCESS BY ID to stop a specific process by using its unique process number.
- Get process activity or Process properties to retrieve the unique process number.
- REJECT NEW REMOTE CONNECTION to block new remote connections.
- Get application info to tell if the connections have been accepted or refused.
- SOAP REJECT NEW REQUESTS to block SOAP requests.
- WEB Get server info to know if connections have been accepted or refused.
- Refresh license to update a license. Read the documentation
New information about the URL used by web processes is available. This information can be retrieved two ways: via the 4D Server Administration Window or via the 4D language with the Get process activity command; a new “url” attribute is added to the process object when the process type is a web process. Read the documentation
The new Get application info command retrieves detailed information about the activity and network configuration of your active database. This command can be called on both a remote client as well as on the 4D Server. Read the documentation
- qr cmd open
- qr cmd save
- qr cmd save as
- qr cmd generate
- qr cmd page setup
- qr cmd print preview
In the callback method, you can intercept all of the managed events, do something, and execute the event with the QR EXECUTE COMMAND command. Read the documentation
Now for each break (subtotal), you can set either a page break or a different line-height. In the case of a different line-height, the difference can be expressed in points (pt) or percentage (%). Read the documentation
You can change the appearance of the frame of a cell, column, or row in your report by changing its color or the line thickness. Place the mouse over the element you want to configure, click on it, then choose the appropriate parameter (the border configuration, line thickness, and the color) from the pop-up window. Read the documentation
The first improvement is a new “Save / Save as” button. Choosing “Save” saves your work by updating the last saved version of the file to match the version on your screen. Choosing “Save As” displays a prompt to save your work as a file with a different name. The second improvement is tooltips (small messages displayed when you hover over an area). They’re added to the subtotal rows to help you easily see the sorting direction: ascending or descending. Read the documentation
A new toolbar is available in 4D Write Pro to help you with the document creation process. By simply dragging and dropping a new item from the Object Library, you get access to a complete toolbar with seven different tabs so you can quickly switch between actions. Read the documentation
You can now manage your own style sheets for paragraphs or characters thanks to a couple of new commands that allow you to create, delete, and import style sheets. A character style sheet allows you to define how a character (or a word) is displayed and printed, while a paragraph style sheet allows you to define margin colors, padding, tabs, borders, and much more. A style sheet is an object belonging to a document. It’s created using the WP New style sheet command. Once created, you can use this object as a parameter for WP Set attributes. Below is the list of the new commands to help you handle stylesheets:
- WP New style sheet: allows creating a style sheet
- WP DELETE STYLE SHEET: allows deleting a style sheet
- WP Get style sheet: allows retrieving a single style sheet by its name,
- WP Get style sheets: fills a collection of style sheets of a given type, and finally,
- WP IMPORT STYLE SHEETS: allows importing existing stylesheets created in another 4D Write Pro document (as a template, for example).
Convert your documents to .docx format
4D Write Pro documents can now be exported in .docx format. To do so, use the new wk docx constant with the existing WP EXPORT DOCUMENT command, or use the WP EXPORT VARIABLE command. Read the documentation
An out-of-the-box feature is provided to enable end-users to resize the width of the columns. Hover over the row separators and the cursor will turn into a double arrow showing that the column can be resized. When clicking and dragging these separators, both left and right columns will be resized. If the shift key is pressed while dragging, only the left columns will be resized and all of the right columns will be shifted. Read the documentation
Adding and removing rows and columns
Managing insertion and deletions of rows and columns is now possible thanks to four new commands: In order to insert rows and columns, two new commands have been created: WP Table insert rows and WP Table insert columns. Both commands return ranges that correspond to parts created inside the table. And in order to remove rows and columns, two more commands are available: WP TABLE DELETE ROWS and WP TABLE DELETE COLUMNS. Read the documentation
Fixed height for headers and footers
A new document attribute: wk header and footer autofit is available to determine if headers and footers should be resized automatically to avoid truncating their contents. This attribute can either be set to True or False. In the case of newly created documents, this parameter will be set to True (auto-resize headers and footers will be activated), and to False if importing a 4D Write Pro document. Read the documentation
Create headers and footers with code
Two new commands have been added: WP New header and WP New footer to allow programmatically creating headers and footers. You can also use code to delete a header and a footer with the WP DELETE HEADER and WP DELETE FOOTER commands. Read the documentation
A new vertical ruler is added. It allows users to graphically manage vertical margins. If your document contains headers or footers, the spaces between them and the body of your document can also be modified with the vertical ruler. The new Show vertical ruler property is available from the Property List, allowing you to enable the display of the ruler. Read the documentation
You can define your document’s page size, orientation, and margins with code. New attributes that can be used with the WP SET ATTRIBUTES and WP GET ATTRIBUTES commands are at your disposal. You can set the properties for an entire 4D Write Pro document. The following values are used by default for all sections of the document which you can then change for a given section:
- wk page width, wk page height – for page size
- wk page orientation – for page orientation
- wk page margin, wk page margin left, wk page margin right, wk page margin top, wk page margin bottom – for page margins. Read the documentation
New attributes to avoid widows, orphans, and page breaks
New options have been added to 4D Write Pro to help you avoid widows and orphans for paragraphs or tables, and page breaks inside paragraphs or tables.
Widows and orphans are the lines at the beginning or end of a paragraph that are left all by themselves at the top or bottom of a page. In order to avoid them, you have a new attribute to use with the WP SET ATTRIBUTES command: wk avoid widows and orphans. The available values for this attribute are wk true or wk false. When this attribute is set for a paragraph or a table, 4D Write Pro prevents this paragraph or table from having a single line separated onto another page.
As for page breaks inside paragraphs or tables, a new attribute is available: wk page break inside. The available values are wk avoid or wk auto. This option is useful when you don’t want a paragraph, several paragraphs, or a table to break across two pages. Read the documentation
A section allows you to obtain different layouts within the same document. For example, for each section, you can define a different paper size and orientation, different margins, different headers and footers, and so on. This results in complex and beautifully designed documents. Sections can be manipulated by code with the WP Get sections command, allowing you to retrieve a collection of sections in your document. The WP Get section command can be used to retrieve the current section. To change the attributes for a specific section, you can pass the section’s reference to the WP SET ATTRIBUTES and WP GET ATTRIBUTES commands. You can also create subsections with code using the new WP Create subsection command. Read the documentation
Large tables are now automatically displayed on more than one page. You don’t have to count rows to check the size of a page or its orientation as tables are dynamically split when a page or a column break occurs. The WP INSERT BREAK command has been updated to support a new constant: wk paragraph break. Read the documentation
4D expressions supported in anchored images
A valid 4D expression can be associated with an anchored picture with the new wk image expression attribute, providing even more flexibility. Just set this constant for any anchored image to define a method that returns a picture. Read the documentation
Get coordinates in a 4D Write Pro document
Now you can get coordinates in a 4D Write Pro document. The WP Get position command returns more information regarding the current position of a range or an element reference using two new attributes: bounds and rangeHeight. The first attribute describes the rectangle surrounding a range according to its type (either “default type” (characters), “paragraph type”, “table type” or “picture type”). It also has attributes of its own: top, bottom, left, and right. The second attribute describes the height of the object’s boundary rectangle. Read the documentation
Table and field expressions inserted into 4D Write Pro documents now support the virtual structure definition of the database. This is done with the SET TABLE TITLES(…;*) and SET FIELD TITLES(…;*) commands. The formula editor also supports the virtual structure, and since 4D automatically sets the user interface based on the system settings, the formula editor will be displayed in the user’s language. Read the documentation
Links in a 4D Write Pro document
WP SET LINK allows you to set URLs and also gives you the ability to invoke a method from your 4D application (with parameters) or target bookmarks from your document. The new WP Get links command returns a collection of all of the links in a document, in a single call. Each link of the collection is an object with a description of the link in its attributes. Read the documentation
View properties can be handled by programming. The WP SET VIEW PROPERTIES command allows dynamically setting one or more view properties of the 4D Write Pro area. The settings can be returned in an object with all of the view properties via the WP Get view properties command. Read the documentation
Tabs can be set with a collection of strings, numeric values, or even a collection of objects! If you only need to modify the default tab values, you can use an object with the new wk tab default constant (added specifically for this purpose). Read the documentation
More targets and renamed commands
The commands listed below have been extended to accept any kind of target as the first parameter. They can still use a range, but now they can also use a reference (header, body, footer), an element (picture, paragraph), or the entire document as target:
- WP SET TEXT
- WP INSERT BREAK
- WP INSERT DOCUMENT
- WP INSERT PICTURE
- WP Insert table
- WP SET ATTRIBUTES
- WP GET ATTRIBUTES
Also, several commands have been renamed:
|Previous name||New name|
|WP Create Paragraph range||WP Paragraph range|
|WP Create Picture range||WP Picture range|
|WP Create range||WP Text range|
|WP Create Table range||WP Table range|
|WP Get bookmark range||WP Bookmark range|
|WP Get selection||WP Selection range|
Work with .xlsx documents using 4D View Pro
The existing 4D View Pro commands, VP IMPORT DOCUMENT and VP EXPORT DOCUMENT, have been enhanced. They now support files using the .xlsx extension (Microsoft Excel). You can just pass your file path to the commands to get up and running. Read the documentation
A feature-rich ribbon-style toolbar
A powerful, ribbon-style toolbar to enhance the 4D View Pro user interface is provided. It allows you to organize 4D View Pro features into a set of tabs, to increase the discoverability of functions and enables quick access to different commands. It’s worth mentioning that this toolbar also introduces new functions such as PDF and CSV export options. Read the documentation
Use methods and database fields
Your database security is enhanced as you now have even more control over the data you choose to make available (or not) to your end-users, as well as which fields or methods allow access.
Commands and variables can’t be called directly from a cell for security reasons, but they can be accessed through allowed methods which return the command’s or variable’s value. Methods can be authorized with the SET ALLOWED METHODS command, tables, or fields that can be declared as virtual structures with the SET TABLE TITLES and SET FIELD TITLES commands. Variables, as well as 4D commands, must be contained in an allowed method. Read the documentation
Get control over your 4D method settings
VP SET ALLOWED METHODS is a new command allowing you to specify a 4D method’s parameters, name, type, and include a summary. Now your methods can be more informative and descriptive to end users. Read the documentation
Now you can define specific options of printing for each sheet with theVP SET PRINT INFO command. These options are used to prepare the document before a PDF export or printing. Now in order to export a document in PDF format, you can use VP EXPORT DOCUMENT command. The information from VP PRINT INFO will be used to automatically embed all of the used fonts in your document, into the generated PDF file. When printing, the VP PRINT command can be used. Read the documentation
The VP Convert to picture command allows you to convert a sheet or part of a sheet to SVG. The SVG can then be used inside a 4D form to be printed as part of a 4D print job, together with other forms or data. Read the documentation
Add new events to the property list
A new set of 4D View Pro form events are available and listed in the property list. They return special information that can be accessed with the FORM Event command: “On Column Resize”, “On Row Resize”, “On Clicked”, “On Double Clicked”, “On Header Click”, “On Selection Change”, and “On After Edit”. When the event occurs, all of the associated information can be retrieved from the object returned by the FORM Event command. Read the documentation
Creating ranges via code is now possible. New commands are available to allow you to define a range object to manipulate your cells: VP Cell, VP Cells, VP Column, VP Row, VP All, VP Combine ranges, and VP Name. Read the documentation
A new set of commands to fill your documents via programming is available: VP SET VALUE, VP SET BOOLEAN VALUE, VP SET DATE TIME VALUE, VP SET DATE VALUE, VP SET TIME VALUE, VP SET NUM VALUE, VP SET TEXT VALUE, VP SET FORMULA, VP SET FIELD, VP Get value, VP Get formula. Read the documentation
A new concept is introduced: named ranges and formulas. You can create two types of names with programming:
The first refers to a range of cells where you can apply a readable name to the cells you’re interested in with the VP ADD RANGE NAME command.
The second refers to a formula with the VP ADD FORMULA NAME command to replace calculations with readable names in your spreadsheets. It also creates a constant and simplifies reading the calculations in your spreadsheet. Read the documentation
Manage selections and the active cell
A set of commands are included to help you set and get the active cell or selection(s) in your documents:
- VP Get active cell
- VP Get selection
- VP SET ACTIVE CELL
- VP SET SELECTION
- VP ADD SELECTION
- VP RESET SELECTION
If you want to view a cell at a specific position in your 4D View Pro area (e.g., top left or bottom right), you can use the VP SHOW CELL command. Read the documentation
Use collections to read and write in 4D View Pro
Four new commands are available to allow you to read a large number of different values or formulas easier, faster, and at the same time via collections: VP SET VALUES, VP Get values, VP SET FORMULAS, and VP Get formulas. To set values or formulas in cells, simply create a collection where each element represents a row. Each row is a collection of cell values to be set in the columns. For reading, you can pass a range of cells to VP Get values. The command returns the values in corresponding collections. Read the documentation
You can programmatically customize the style of your 4D View Pro documents. Three different options are available. You can use the:
- default style commands to define the general style of a sheet with the VP SET DEFAULT STYLE and VP Get default style commands, or
- style sheet commands to define frequently used custom styles with the VP ADD STYLESHEET, VP REMOVE STYLESHEET, VP Get stylesheet, and VP Get stylesheets commands, or
- cell style commands to define the style of specific cells with the VP SET CELL STYLE and VP Get cell style commands.
Also, the new VP SET BORDER command has been added so you can manage the borders of a range. Read the documentation
R-releases in depth