Read the return or output parameter of command script

Hello.

How do I read the return or parameter
of command script?

Ex:

var sql = ‘select max(id) as maxid from table’;
var resultsql = lda.selectSQL(sql);

In my client (delphi) I need to read
this variable “resultsql” (which is an output parameter).

Hello

Could you elaborate what you are trying to do? It is not clear where/how this ‘command script’ is executed and the platform of the server app (.NET or Delphi)

I use command scripts for various operations, I use
in Relativity Server, I need to access a return parameter …

Imagine a command scripts that I wanted to know the date and time of the
server (this is a hypothetical example), as I would do to read this in a
delphi client?

Unfortunately you cannot. There is no support for such scripts in Relativity

What is the “out” and “result” parameter direction for ?

image

I tried to read in Delphi, but it did not work

>   lDARemoteCommand := TDARemoteCommand.Create(nil);
>   lDARemoteCommand.RemoteService := DMConnection.RemoteService;
>   try
>     with lDARemoteCommand.ExecuteCall do
>     begin
>       MethodName := 'ExecuteCommandEx';
>       Params.Clear;
>       OutgoingCommandNameParameter := Params.Add('ACommandName', rtString, fIn).Name;
>       OutgoingParametersParameter := Params.Add('aInputParameters', rtUserDefined, fIn, 'DataParameterArray').Name;
>       IncomingAffectedRowsParameter := Params.Add('Result', rtInteger, fResult).Name;
>       IncomingParametersParameter := Params.Add('aOutputParameters', rtUserDefined, fOut, 'DataParameterArray').Name;
>       lDARemoteCommand.Execute(ACommandName, AParamNames, AParamValues);
>       Params.ParamByName(IncomingParametersParameter).OwnsComplexType := True;
>     end;
>   finally
>     FreeAndNil(lDARemoteCommand);
>   end;

For parameters being sent out by the SQL statement tied to this schema command (either a Stored Procedure or a plain SQL added to the Schema)

What exactly did you try?

Because inside command I can read a parameter assigned from my
delphi application and can not do the reverse? (my application read a
output parameter)

function beforeExecuteCommand(sql, commandName, names, values)
{
   for (var i=0,len=names.length; i<len; i++)
   {
  if (names[i] == "idTurma")   // Here I can read this parameter, which I passed through my application in delphi ..
      var idTurma = values[i];
     }
   }
   Result =  'something bla bla'  // I wanted to read this parameter in my application delphi.