You are not logged in.
Can any show simple example?
I watch 27 - CrossPlatform Clients, but in this sample no grid. Thank you for advice!
Last edited by dbacc55 (2018-03-19 13:59:22)
Offline
any help or advice?
Offline
hi, i try create sample use example https://synopse.info/forum/viewtopic.php?id=1115
and all be ok, but i find new function
    function ToObjectList<T: TSQLRecord>: TObjectList<T>; overload;and try to use it, but function not works fine, only get all records but not data in fields
i try debug and find forgot RecordType
    function ToObjectList<T: TSQLRecord>(RecordType: TSQLRecordClass=nil): TObjectList<T>; overload;AB pls add
Type
  TSQLRest = class
...
    function RetrieveList(Table: TSQLRecordClass; const FormatSQLWhere: PUTF8Char;
      const BoundsSQLWhere: array of const;
      const aCustomFieldsCSV: RawUTF8=''): TObjectList<TSQLRecord>; overload;
...
function TSQLRest.RetrieveList(Table: TSQLRecordClass; const FormatSQLWhere: PUTF8Char;
  const BoundsSQLWhere: array of const;
  const aCustomFieldsCSV: RawUTF8=''): TObjectList<TSQLRecord>; 
var SQL: RawUTF8;
    T: TSQLTable;
begin
  result := nil;
  if (self=nil) or (Table=nil) then
    exit;
  T := MultiFieldValues(Table,aCustomFieldsCSV,FormatSQLWhere,BoundsSQLWhere);
  if T<>nil then
  try
    result := T.ToObjectList<TSQLRecord>(Table);
  finally
    T.Free;
  end;
end;and fix function to ToObjectList<T: TSQLRecord>
    function ToObjectList<T: TSQLRecord>(RecordType: TSQLRecordClass=nil): TObjectList<T>; overload;
...
function TSQLTable.ToObjectList<T>(RecordType: TSQLRecordClass=nil): TObjectList<T>;
var R,Item: TSQLRecord;
    Row: PPUtf8Char;
    i: integer;
begin
  result := TObjectList<T>.Create; // TObjectList<T> will free each T instance
  if (self=nil) or (fRowCount=0) then
    exit;
  R := RecordType.Create;
//  R := TSQLRecordClass(T).Create;
  try
    R.FillPrepare(self);
    Row := @fResults[FieldCount];     // Row^ points to first row of data
    result.Count := fRowCount;
    for i := 0 to fRowCount-1 do begin
//      Item := TSQLRecordClass(T).Create;
      Item := RecordType.Create;
    {$ifdef ISDELPHIXE3}
      PPointerArray(result.List)[i] := Item; // faster than manual Add()
    {$else}
      Result.Add(Item);
    {$endif}
      R.fFill.Fill(pointer(Row),Item);
      Item.fInternalState := Self.InternalState;   // Filling InternalState property
      Inc(Row,FieldCount); // next data row
    end;
  finally
    R.Free;
  end;
end;all sample project is based on a project (04 - HTTP Client-Server) by add Project04ClientFMX.dpr
https://www.dropbox.com/sh/64f4j4akzp8r … D-Y7a?dl=0
Offline
i think be a cool if u add Project04ClientFMX.dpr to sample source folder
Last edited by noobies (2018-03-19 10:40:49)
Offline
Thank you noobies for sample
Offline
@noobies - it's very hard to maintainers to analyze proposed changes from the forum post. The common way to contribute to open source project is to create a pull request on github. In this case everyone can see the diff between original and modified code. The same is about adding samples. Please, save @ab's time 
Offline
@mvp
my pull first commit
https://github.com/synopse/mORMot/pull/99
Offline
Welcome on github, and congrats for the first pull request!
Well done!
I made some comments, but I don't understand why you wanted to use generics here, since they are SOOO broken in Delphi.
The regular TSQLSomeRecord.FillPrepare/FillOne pattern is much preferred, and more efficient.
Offline
@ab
Because I do not understand how to make an example without using generics in fmx 
Last edited by noobies (2018-03-21 13:09:36)
Offline