Read 4D object fields with SQL Engine

A 4D object field is a persistent database field type, stored as binary content. Previously, reading this type of field by an ODBC driver wasn’t possible. Until today.

Before, an error was returned when trying to read an object field. This prevented the completion of simple Select * from myTable requests, which could be frustrating for users who only wanted to browse the content of a table.

Good news! The SQL engine has been updated to allow 4D object fields to be read.


With the updated SQL engine and ODBC driver, instead of returning an error when reading an object field, the field is now returned as binary content.

SQL CAST function on 4D object field

To browse the content of an object field, the SQL CAST function has been extended to return a JSON representation of it (provided the object can be shown in JSON format).

Now you can sit back and enjoy using Select * from myTable to check all of your database’s content … from 4D, Excel, or Crystal Reports!


The query below can now be run:

SELECT, CAST (Persons.address as VARCHAR) FROM Persons

And here is the result with MS Query:

Reading an object field using SQL in 4D

You can also read an object field in a C_OBJECT variable.


Begin SQL
SELECT address FROM Persons WHERE name = 'Smith' into :$obj;


• Product Owner • Marie-Sophie Landrieu-Yvert has joined the 4D Product team as a Product Owner in 2017. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Marie-Sophie graduated from the ESIGELEC Engineering School and began her career as an engineer at IBM in 1995. She participated on various projects (maintenance or build projects) and worked as a Cobol developer. Then she worked as an UML designer and Java developer. Lately her main roles were analyzing and writing functional requirements, coordinate business and development teams.