KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Accessing Objects Through SQL Engine
PRODUCT: 4D | VERSION: 17 R | PLATFORM: Mac & Win
Published On: October 2, 2019

As of 4D17R5 it is possible to access 4D object type fields. The SQL engine and ODBC drivers have been updated to return object type data as binary content, which is not easily readable, however using the SQL CAST function, the data can be casted as a VARCHAR to display the data in JSON format.

SELECT CAST(Table_1.ObjectField as VARCHAR) FROM Table_1

It is also possible to directly load the binary content into a 4D C_OBJECT variable.

C_OBJECT(myObject)
Begin SQL
  SELECT ObjectField FROM Table_1 INTO :myObject;
End SQL


There are limitations to this feature as it is only possible to read the object type data and it is not possible to write or modify new data.