Mandatory: Boolean;
The Mandatory property returns True if empty values in the field are not allowed.
Sub Main;
Var
MB: IMetabase;
DSInst: IDatasetInstance;
DSModel: IDatasetModel;
Fields: IDatasetModelFields;
Field: IDatasetModelField;
s: String;
Begin
MB:=MetabaseClass.Active;
DSInst:=MB.ItemById("Table_1").Open(Null) As IDatasetInstance;
DSModel:=DSInst.Dataset;
Fields:=DSModel.Fields;
Field:=Fields.Item(0);
If Field.Mandatory Then
s:="No";
Else
s:="Yes";
End If;
End Sub Main;
After executing the example, the "s" variable contains Yes, if empty values in the first field of data source are allowed. The identifier of data source is Table_1.
See also: