Build a custom remote connection dialog

Automatically translated from English

Do you need to build a customized 4D connection dialog? Interested in connecting your client application to different servers? Two different scenarios that 4D v18 allows you to handle. This blog post is for you if you want to create a custom remote connection dialog or deploy merged, standalone 4D applications to merged 4D servers. Keep reading!

Why should I write my own connection dialog?

There are several use cases for connecting a merged, standalone application to a merged server:


You want to customize 4D’s standard dialog for remote connections to the server.


When you deploy your application and create several databases. For example, you may have a different database for each subsidiary of a group. In the connection database, you can manage which server databases users can connect to and allow them to connect directly.

Archive databases

A related way of using a custom dialog is to choose which archived fiscal year database users can connect to.


If you deploy several products and want your users to use a single “portal” application which allows them to connect to each product.

Use case

A software publisher has a server farm hosted in the cloud, each one corresponding to a business need. They used to deploy as many remote applications as the user can access to the servers. Now, the developer can create a “directory” database. Using HTTP requests or remote datastores, each server maintains its status and connection information to the “directory” server. The merged, standalone connection application can then query the directory database, view a list of available servers, and then connect to one.

How to do that?

We’ve extended the OPEN DATABASE command to permit connecting to a 4D Server. You just need to generate a 4DLink file which contains the server location and port, then pass it as a parameter to the command. The merged, standalone application will automatically stop its code and connect to the server, becoming a typical remote application.

Here’s a code snippet from a server selection dialog where Form.selectedServer contains the 4D Server information:

If (Form.selectedServer#Null)
 $xml:="<?xml version=\"1.0\" encoding=\"UTF-8\"?><database_shortcut is_remote=\"true\" server_database_name=\"FA_RemoteConnexionServ\" server_path=\""+Form.selectedServer.IP+":"+Form.selectedServer.portID+"\"/>"
 $link:=Folder(fk user preferences folder).file("server.4dlink")
 OPEN DATABASE($link.platformPath)
End if

What about AUTOMATIC updates?

We’ve created the new buildApp keys, DatabaseToEmbedInClientWinFolder and DatabaseToEmbedInClientMacFolder, which contain the paths of the compiled, standalone connection database. When building a remote application, it will embed the compiled database and become a merged, standalone application without needing a data file. When this merged, standalone application connects to the server, if its version is not in the server’s range, it launches the automatic update as it would if the application were a remote client.


• Product Owner •

Damien Fuzeau has joined the 4D Product team in February 2019. As a Product Owner, he is in charge of writing user stories, then translating them to functional specifications. His job also entails making sure that the feature implementations delivered are meeting the customer needs.

Damien is graduated from the University of Nantes in software engineering. He spent more than 23 years in its former company, first as developer (discovering 4D in 1997), and later as engineering manager and software architect. This company is a 4D OEM partner and deployed 4D based business softwares for thousands users, on hundreds servers. So, Damien is used to 4D development and deployment in a multi-language context.