This function should convert a solution given at: eval fields of a record into a reuseable function. Actually this code below does not compile and I have no idea how to get it functional ...
procedure EnumerateFieldandValues(const m: TObject; RecordParams: TStringList);
var
i: Integer;
rtype: TRTTIType;
fields: TArray<TRttiField>;
begin
rtype := TRttiContext.Create.GetType(TypeInfo(TObject.ClassType));
// Memo1.Lines.Add(rtype.ToString);
fields := rtype.GetFields;
for i := 0 to High(fields) do
RecordParams.Add(Format('%s: %s :: %s', [fields[i].Name,
fields[i].FieldType.ToString, fields[i].GetValue(@m).ToString]));
end;