Process Table on Middle tier and return it to client

Hello,

I’m just new customer to DA-Delphi, so please execue me if this a basic question :wink:

I build new DA server, and added tables to the SM, I can connect directly to tables on server from the client.

what I want to get, is do some work on the table on DA Server like modifying some records fields before return it to the client.

Thank you.

Hello,

what I want to get, is do some work on the table on DA Server like modifying some records fields before return it > to the client.

  1. You could handle onWriteFieldValueEx event of TDABin2DataStreamer (or the streamer you use) on the server:

procedure TDataService.DataStreamerWriteFieldValueEx(const aDataset: IDADataset;
const aField: TDAField; var Value: Variant);
begin

if aField.Name=‘FieldName’’ then
Value:=NewValue;

end;

  1. Also have a look at Data Memory sample, maybe it will be useful for you.

Hope that helps.

Thank you for your answer, however seems I wasn’t clear enough.

  1. i don’t think this is an acceptable solution, because as I said I need to do a lot of processing on middle tier for some operations. trying to change value on event isn’t good one for this situation.

  2. I looked there, spent sometime understating the sample, also it may not be as I want.

Here’s the question in other view.

Can I return table not defined on the SM?, like method with result as DataTable?

using DA or RO.

Hello,

Sorry for belated answer.

Can I return table not defined on the SM?, like method with result as DataTable?

We have Dynamic SQL sample, that shows how to retrieve schema and/or data  via SQL generated at runtime.

Also look at SQLGetData method of DataAbstractService (DataAbstractService_Impl.pas) - and try to write similar method doing necessary operations on result Dataset. Read discussion http://connect.remobjects.com/discussion/168/how-to-load-a-dynamic-dataset-into-a-damemdatatable .

And take a look at business rules scripting, maybe it could be useful for you 
http://wiki.remobjects.com/wiki/Business_Rules_Scripting
http://wiki.remobjects.com/wiki/Business_Rules_Scripting_Overview

Hope that helps.