I am using delphi XE7, and I need help to transform TRestResponse
content to TFDJSONDataSets
on the client side of a Rest Client application.
In the code posted below I need a function in this line:
LDataSets := function(sContent)-->transform sContent to TFDJSONDataSets
How can I do this?
//client side
procedure TaskComplete;
var sContent:string;
LDataSets: TFDJSONDataSets;
begin
sContent:=ModuloCliente.RESTResponse1.content;
LDataSets := function(sContent)-->Here I need to transform sContent to TFDJSONDataSets
//Prepare temp MemoryTable
memTable.Active := False;
memTable.AppendData(TFDJSONDataSetsReader.GetListValue(LDataSets, 0));
end;
//request to rest server
procedure DoRequest;
begin
ModuloCliente.RESTClient1.BaseURL:='http://localhost:8080/datasnap/rest/TsrvServerMetodos';
ModuloCliente.RESTRequest1.Resource:='"pending_msg_to_user_token"/{param1}';
ModuloCliente.RESTRequest1.Params.ParameterByName('param1').Value:='1';
ModuloCliente.RESTRequest1.ExecuteAsync(TaskComplete,true,true);
end;
//server side
function TSrvServerMetodos.pending_msg_to_user_token(qry:string): TFDJSONDataSets;
begin
qryStaff.Active := False;
with qryStaff do begin
Params.Clear;
SQL.Clear;
unprepare;
SQL.Add(qry);
end;
Result := TFDJSONDataSets.Create;
TFDJSONDataSetsWriter.ListAdd(Result, qryStaff);
end;