Dynamic Where Clause and ParamByName

Is it possible to use parameters built into the query, in addition to using dynamic where clauses (ie.Where.AddCondition… etc.)

It appears that the classic Delphi dynamic where does not work against a Remobjects/NET middle-tier. Am I doing something wrong. Is there a way to dynamically adjust the where clause of a delphi client against the RO/.NET middte-tier?

Regards,
Monte Carver

Hello

For .NET accessing parametrized table with DynamicWhere conditions would look like

var dt = new DataTable("OrderDetails");
var tri = new RemObjects.DataAbstract.Server.TableRequestInfoV5();

tri.Parameters = new[] { new RemObjects.DataAbstract.Server.DataParameter("Qty", 10) };
tri.WhereClause = (new RemObjects.DataAbstract.Expressions.BinaryExpression(
		 new RemObjects.DataAbstract.Expressions.FieldExpression("Price"),
		 new RemObjects.DataAbstract.Expressions.ConstantExpression(20.00),
		 RemObjects.DataAbstract.Expressions.BinaryOperator.Equal))
				.ToXmlNode();
tri.IncludeSchema = true;

this.fDataModule.DataAdapter.Fill(dt, tri, true);

Here ‘Qty’ is name of the table parameter.

Does similar code work for the Delphi client? Also what code did you use on the Delphi side to access such table that failed to access the table?

Using a delphi client, I have tried against the RO/.NET server the following code. This code produces no errors, but is ignored in that records are retrieved WITH OUT the use of the dynamically added where clause.

with lkTech do
    begin
      Active := False;
      LogicalName := ‘lk_TECH_REQUEST’;
      LoadSchema;

lwb := TDAWhereBuilder.Create;
      try
        if ARequestID <> ‘’ then
        begin
          lwExp := lwb.NewBinaryExpression(
              lwb.NewField( lkTech.LogicalName, ‘RR.REQUEST_ID’),
              lwb.NewConstant(ARequestID, datString),
          dboEqual);
        end;
        lwb.Expression := lwExp;
        Active := True;
      finally
        lwb.Free;
      end;

Furthermore, I have also attempted the following approach
      with lkTech.where do
      begin
        Clear;
        AddCondition(‘RR.REQUEST_ID’, cEqual, QuotedStr(ARequestID));
end;
lkTech.Active := True;

Neither approach works against an RO/.NET server. I have successfuly used the last approach many years times in the past years aganst a RO/Delphi server.

Please advise. How does one use dynamic where from a RO/Delphi client to a RO/.NET server. Ideally with using predefined ParamByName parameters.

Regards,
Monte Carver

In general both DA/.NET and DA/Delphi servers should behave in the same way in this case.

How does look the Schema statement for the table being accessed? Also could you create a simple testcase where this issue is reproduced?