I am building an async client, and there is a problem when i call the IDataAbstractService_Async methods, where when i call the invoke_getdata, i would like to pass parametes with filters to the server.
I suppose it has to be done on the invoke_getdata, in order to have the server fetch the proper data, and get them back with the retrieve_getdata.
Is this the right way to implement the above mentioned question, or do i have to implement it with a different way
Manos
Hello,
In order to use GetData method with parameters you should define SQL statement for DataTable in schema with necessary parameters, then add these parameters in TableRequestInfoArray
with aTableRequestInfoArray.Add do
begin
IncludeSchema := True;
MaxRecords := -1;
with Parameters.Add do begin
Name:='ParamName';
Value:=ParamValue;
end;
end;
and call
fServ.Invoke_GetData(aTableList, aTableRequestInfoArray);
You could also use SQLGetData method with direct SQL query in order to retrieve only proper data
Best regards.
Thank you for the reply, I’l test both ways, and let you know in case of problem
Best regards
Hello again
I have used Invoke_GetData with TableRequestInfoV5, and not the SqlGetData, which i believe not to be a safe one, especially because I am building a data farm, with about 5-8 sql servers, and about some hundreds of same schema databases.
On the other hand, i don’t want to use parameters in my datatable schema, so i would’t have to reconstruct those sql every time i need a knew parameter.
So i believe with TableRequestInfoV5, i could do the job.
I invoke the Invoke_GetData, construct the TableRequestInfoV5 parametes, and i got a timer to invoke the Retrieve_GetData, in order to display the actual data, but i don’t know how to process the TRObinarymemorystream witch is returned.
I could use some of your help. I could provide source code, to be more helpful.
Best Regards
Hello,
You could load data from returned Binary like this:
fData:=fserv.Retrieve_GetData();
ClientDataModule.DataStreamer.Initialize(fData,aiRead);
try
// load schema
ClientDataModule.DataStreamer.ReadDataset(
ClientDataModule.DataStreamer.DatasetNames[0],
ClientDataModule.tbl_TableName, true, false);
ClientDataModule.tbl_TableName.InitializeDataTable;
// load records
ClientDataModule.DataStreamer.ReadDataset(
ClientDataModule.DataStreamer.DatasetNames[0],
ClientDataModule.tbl_TableName, false, true, false);
finally
ClientDataModule.DataStreamer.Finalize;
end;
Hope this helps
Hello again, and thank you once more for the effort
I tried to load the returned binary with the datasteamer, but doesn’t work as expected.
Seems like, when i Retrieve_Getdata, the DA reloads all data to binary, ignoring the allready invoke_getdata function. I have checked the Invoke_getdata with TableRequestInfoV5 and the wherechause and works fine.
I have attached my source code in order to investigate.
hope my source, helps you
ps i have allready used the dtmBRClient.bdsPatient.ReadDataset(fData,aTable,True) in my code without any success.
Thanks in advance
Back again, i found the problem in my code.
It was wrong initialization for the cdspatient dataset
Thank you again.