I have some problem defining the fields of a TmemDataset. I want to use a memDataset with some files to keep and manipulate the data for a small personal project.
here are the code snipet I use to create the fields :
function createField(fieldName, fieldLabel : String ; fieldType : TFieldType;
group : Integer) : TField;
begin
Result := TField.Create(nil);
Result.FieldName := fieldName;
Result.SetFieldType(fieldType);
Result.FieldKind := fkData;
if fieldLabel = '' then
Result.DisplayLabel := fieldName
else
Result.DisplayLabel := fieldLabel;
result.DataSet := memDataset;
Result.Tag:= group;
end;
The call is quite simple :
createField('FIELDNAME', 'FieldDisplay', ftInteger, 2);
Unfortunately, this does not properly set the field type and compromise the whole data editing afterwards. I get a ftUnknown field type. How can I set the proper type for my fields ?