MacroExpression

The MacroExpression is part of the Dynamic Where feature; it represents a call to a macro function.

Implementation

Example

Target SQL where clause:

WHERE SUBSTRING(lastname FROM 1 FOR 3) = 'Col'

WhereExpression where = new BinaryExpression(
                          new MacroExpression("Copy(lastname,1,3)"),
                          new ConstantExpression("Col"),
                          BinaryOperator.Equal);

let whereExpression = BinaryExpression(
                        MacroExpression("Copy(lastname, 1, 3)"),
                        ConstantExpression("Col"),
                        BinaryOperator.Equal)

WhereExpression where = new BinaryExpression(
                          new MacroExpression("Copy(lastname,1,3)"),
                          new ConstantExpression("Col"),
                          BinaryOperator.Equal);

let whereExpression = BinaryExpression(
                        MacroExpression("Copy(lastname, 1, 3)"),
                        ConstantExpression("Col"),
                        BinaryOperator.Equal)

with ClientDataModule.tbl_SALESMEN,DynamicWhere do begin
  Expression:=NewBinaryExpression(
                NewMacro('Copy(lastname,1,3)'),
                NewConstant('Col'),
                dboEqual);
end;

myTable.dynamicWhere = new RemObjects.DataAbstract.DynamicWhere(
              new RemObjects.DataAbstract.BinaryExpression(
                new RemObjects.DataAbstract.MacroExpression("Copy(lastname,1,3)"),
                new RemObjects.DataAbstract.ConstantExpression("String", "Col"), "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">
      <macro name="Copy(lastname,1,3)"/>
        <constant type="WideString" null="0">Col</constant>
    </binaryoperation>
  </where>
</query>