DateTimeTodayExpression

The DateTimeTodayExpression is part of the Dynamic Where feature; it represents current database server date.

No operands are used by this expression.

Implementations

Example

Target SQL where clause:

WHERE order_date = CAST(GETDATE() AS DATE)

 

WhereExpression whereExpression = new BinaryExpression(
                  new FieldExpression("ORDERS", "order_date"),
                  new DateTimeTodayExpression(),
                  BinaryOperator.Equals);

 

let whereExpression = BinaryExpression(
            FieldExpression("ORDERS", "order_date"),
            DateTimeTodayExpression(),
            BinaryOperator.Equals)

 

WhereExpression where = new BinaryExpression(
              new FieldExpression("ORDERS","order_date"),
              new DateTimeTodayExpression(),
              BinaryOperator.Equals);

 

let whereExpression = BinaryExpression(
            FieldExpression("ORDERS", "order_date"),
            DateTimeTodayExpression(),
            BinaryOperator.Equals)

 

with ClientDataModule.tbl_ORDERS, DynamicWhere do begin
  Expression := NewBinaryExpression(
          NewField(LogicalName, 'order_date'),
          NewToday(),
          dboEquals);
end;

 

myTable.dynamicWhere = new RemObjects.DataAbstract.DynamicWhere(
      new RemObjects.DataAbstract.BinaryExpression(
        new RemObjects.DataAbstract.FieldExpression("order_date"),
        new RemObjects.DataAbstract.DateTimeTodayExpression(),
        "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="ORDERS">order_date</field>
      <datetimetoday/>
    </binaryoperation>
  </where>
</query>
{
  "type": "query.where",
  "expression": {
    "type": "binaryoperation",
    "left": {
      "type": "field",
      "field": "order_date",
      "table": "ORDERS"
    },
    "operator": "Equal",
    "right": {
      "type": "datetimetoday"
    }
  }
}