Field properties
For other field properties, please refer to doc.4d.com.
Class
This property is available for fields of type Object (in 4D projects only). It allows you to define a class-typed object field, enhancing code completion, syntax checking, and runtime validation when typing code that involves object fields.
You can enter any valid class name in this property, including:
- User classes (e.g.
cs.MyClass
) - Built-in 4D classes (e.g.
4D.File
,4D.Folder
) - Exposed component-defined classes (e.g.
cs.MyComponent.MyClass
)
If you enter an invalid class name, a warning is triggered and the input is rejected.
Non-streamable classes such as ORDA Data Model classes, file handles, web server... cannot be associated to object fields.
In your code, when assigning a value to a class-typed object field, 4D verifies that it belongs to the declared class. If not or if the object has no class, an error is triggered. Accessing unknown attributes will also raise syntax errors.
To retrieve the associated class name at runtime, use the classID
property, for example ds.MyTable.MyField.classID
.