FieldExpression

The FieldExpression is the part of the Dynamic Where feature representing data table fields.

Implementation

Example

Target SQL where clause:

WHERE LASTNAME = 'Frank'

 

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

 

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

 

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

 

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

 

with ClientDataModule.tbl_SALESMEN, DynamicWhere do begin
  Expression:=NewBinaryExpression(
                NewField(LogicalName,'LastName'),
                NewConstant('Frank'),
                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/JSON

<?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="WideString" null="0">Frank</constant>
    </binaryoperation>
  </where>
</query>
{
  "type": "query.where",
  "expression": {
    "type": "binaryoperation",
    "left": {
      "type": "field",
      "field": "LastName",
      "table": "SALESMEN"
    },
    "operator": "Equal",
    "right": {
      "type": "constant",
      "datatype": "WideString",
      "value": "Frank"
    }
  }
}