ConstantExpression

The ConstantExpression is part of the Dynamic Where feature; it represents a constant in where expressions.

Implementation

Example of usage

Target SQL where clause:

WHERE LASTNAME = 'Frank'

WhereExpression where = new BinaryExpression(
                           new FieldExpression("SALESMEN","LastName"),
                           new ConstantExpression("Frank", DataType.String),
                           BinaryOperator.Equal
                        );

let whereExpression = BinaryExpression(
                        FieldExpression("SALESMEN", "LastName"),
                        ConstantExpression("Frank", DataType.String),
                        BinaryOperator.Equal)

WhereExpression where = new BinaryExpression(
                           new FieldExpression("SALESMEN","LastName"),
                           new ConstantExpression("Frank", DataType.String),
                           BinaryOperator.Equal);

let whereExpression = BinaryExpression(
                        FieldExpression("SALESMEN", "LastName"),
                        ConstantExpression("Frank", DataType.String),
                        BinaryOperator.Equal)

with ClientDataModule.tbl_SALESMEN, DynamicWhere do begin
  Expression:=NewBinaryExpression(
                NewField(LogicalName,'LastName'),
                NewConstant('Frank', datString),
                dboEqual);
end;

myTable.dynamicWhere = new RemObjects.DataAbstract.DynamicWhere(
                new RemObjects.DataAbstract.BinaryExpression(
                new RemObjects.DataAbstract.FieldExpression("LastName"),
                new RemObjects.DataAbstract.ConstantExpression("String", "Frank"), "Equal")
            ));

Generated XML

<?xml version="1.0"?>
<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0">
  <where>
    <binaryoperation operator="Equal">
      <field tablename="SALESMEN">LastName</field>
      <constant type="String" null="0">Frank</constant>
    </binaryoperation>
  </where>
</query>