BetweenExpression
The BetweenExpression is part of the Dynamic Where feature; it represents the BETWEEN
SQL operator.
Implementations
- BetweenExpression (.NET)
- BetweenExpression (Java)
- TDABetweenExpression (Delphi)
- BetweenExpression (JavaScript)
Example
Target SQL where clause:
WHERE PRICE BETWEEN 20 AND 50
WhereExpression where = new BetweenExpression(
new FieldExpression("OrderDetails","Price"),
new ConstantExpression(20),
new ConstantExpression(50));
let whereExpression: WhereExpression = RemObjects.DataAbstract.Expressions.BetweenExpression(
FieldExpression("OrderDetails","Price"),
ConstantExpression(20),
ConstantExpression(50))
WhereExpression where = new BetweenExpression(
new FieldExpression("OrderDetails","Price"),
new ConstantExpression(20),
new ConstantExpression(50));
let whereExpression: WhereExpression = BetweenExpression(
FieldExpression("OrderDetails","Price"),
ConstantExpression(20),
ConstantExpression(50))
with ClientDataModule.tbl_OrderDetails, DynamicWhere do begin
Expression:=NewBetweenExpression(
NewField(LogicalName, 'Price'),
NewConstant(20),
NewConstant(50));
end;
myTable.dynamicWhere = new RemObjects.DataAbstract.DynamicWhere(
new RemObjects.DataAbstract.BetweenExpression(
new RemObjects.DataAbstract.FieldExpression("Price"),
new RemObjects.DataAbstract.ConstantExpression("Integer",20),
new RemObjects.DataAbstract.ConstantExpression("Integer",50))
);
Generated XML/JSON
<?xml version="1.0"?>
<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0">
<where>
<between>
<field tablename="OrderDetails">Price</field>
<constant type="Byte" null="0">20</constant>
<constant type="Byte" null="0">50</constant>
</between>
</where>
</query>
{
"type": "query.where",
"expression": {
"type": "between",
"expression": {
"type": "field",
"field": "price",
"table": "OrderDetails"
},
"lower": {
"type": "constant",
"datatype": "Byte",
"value": "20"
},
"upper": {
"type": "constant",
"datatype": "Byte",
"value": "50"
}
}
}