Dynamic Where XML Format

From RemObjects Wiki

Jump to:navigation, search

This is a Data Abstract Architecture topic
Feel free to add your notes to this topic below.



Query node

The root node of the DynamicWhere expression is the query node. It has two mandatory attributes: xmlns and version.

Sample

<query 
  xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" 
  version="5.0">
</query>


Where node

Each query node should have only one where node. The where node has no attributes. It can hold only one of the following nodes:

Sample

<query 
  xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" 
  version="5.0">
    <where>
      ...
    </where>
</query>


Binaryoperation node

The binaryoperation node represents a BinaryExpression instance. It must have exactly two nodes, representing the Left and the Right expressions that the operator applies to. The operator attribute can have the following values:

  • And
  • Or
  • Xor
  • Less
  • LessOrEqual
  • Greater
  • GreaterOrEqual
  • NotEqual
  • Equal
  • Like
  • In
  • Addition
  • Subtraction
  • Multiply

Sample

<binaryoperation operator="Equal">
  <field>EmployeeID</field>
  <constant type="Integer" null="0">5</constant>
</binaryoperation>


UnaryOperation node

The unaryoperation node represents the UnaryExpression instance. It can have only one node and operator attribute.

Sample

<unaryoperation operator="Not">
  <null />
</unaryoperation>

or just

<unaryoperation>
  <null />
</unaryoperation>


Constant node

The constant node represents the ConstantExpression instance. Inside Dynamic Where it is usually used as right expression inside the binaryoperation node.

It has a type attribute that specifies the type of constant. The type can be any of following:

  • AutoInc
  • Blob
  • Boolean
  • Byte
  • Cardinal
  • Currency
  • DateTime
  • Decimal
  • Float
  • Guid
  • Integer
  • LargeAutoInc
  • LargeInt
  • LargeUInt
  • Memo
  • ShortInt
  • SingleFloat
  • SmallInt
  • String
  • Unknown
  • WideMemo
  • WideString
  • Word
  • Xml


The null attribute shows the value null or not. It can take values 0 (which means the value is NOT null) or 1 (meaning the value IS null)

Sample

<constant type="Integer" null="0">5</constant>

or

<constant type="String" null="0">King</constant>


Parameter node

The parameter node represents ParameterExpression. The value of the parameter node is the parameter name. This node has the following attributes:

  • AutoInc
  • Blob
  • Boolean
  • Byte
  • Cardinal
  • Currency
  • DateTime
  • Decimal
  • Float
  • Guid
  • Integer
  • LargeAutoInc
  • LargeInt
  • LargeUInt
  • Memo
  • ShortInt
  • SingleFloat
  • SmallInt
  • String
  • Unknown
  • WideMemo
  • WideString
  • Word
  • Xml

Sample

<parameter 
  type="String" 
  size="50">pEmployeeName</parameter>

or

<parameter 
  type="Integer" 
  size="0">pEmployeeID</parameter>


Field node

The field node represents the FieldExpression, which is the field reference of the table in the schema.

Sample

<field>EmployeeID</field>

or

<field>FirstName</field>

Null node

The null node represents the NullExpression. It is usually used as part of unary expressions.

Sample

<unaryoperation operator="Not">
  <null />
</unaryoperation>


Macro node

The macro node represents the MacroExpression. It has a name attribute as the macros name. If the macros takes parameters, they should be listed as expression nodes inside the macro node, as you can see in the sample below:

Sample

<macro name="UpperCase">
  <constant type="String" null="0">test</constant>
</macro>


DataTypes formats

Type
Sample Value
Description
AutoInc 15 integer value as string.
Blob BF12F25POD4556KF value encoded to Base64 string format.
Boolean True True or False.
Byte 2 value as string.
Cardinal 1234 in string format.
Currency 123,45->1234500 with accuracy 4 number after comma as integer in string format.
DateTime 1231505053 Unix/Linux style date-and-time value as int64 in string format.
Decimal 125 as decimal in string format.
Float 12.34 as double in string format.
Guid 6C8DE133-9E4D-433A
-BC4E-D4A1E49EAAB0
as string in following format
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
without braces.
Integer 52 value as string.
LargeAutoInc 4585 value as string.
LargeInt 5414 value as string.
LargeUInt 41 value as string.
Memo "This is the long text" value as string.
ShortInt 15 value as string.
SingleFloat 32.14 as double in string format.
String "Just text value" value as string.
Unknown - not supported in Dynamic Where.
WideMemo "This is the long text" value as string.
WideString Just text value value as string.
Word 2 value as string.
Xml <node attr="1"> AAA</node> outer xml as string.


Some complex samples of the Dynamic Where expressions

<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0">
  <where>
    <binaryoperation operator="And">
      <binaryoperation operator="Equal">
        <field>EmployeeID</field>
        <parameter type="Integer" size="0">pEmployeeID</parameter>
      </binaryoperation>
      <binaryoperation operator="Equal">
        <field>FirstName</field>
        <parameter type="String" size="50">pEmployeeName</parameter>
      </binaryoperation>
    </binaryoperation>
  </where>
</query>

<query xmlns="http://www.remobjects.com/schemas/dataabstract/queries/5.0" version="5.0">
  <where>
    <binaryoperation operator="Or">
      <binaryoperation operator="And">
        <binaryoperation operator="Equal">
          <field>EmployeeID</field>
          <parameter type="Integer" size="0">pEmployeeID</parameter>
        </binaryoperation>
        <binaryoperation operator="Equal">
          <field>FirstName</field>
          <parameter type="String" size="50">pEmployeeName</parameter>
        </binaryoperation>
      </binaryoperation>
      <binaryoperation operator="In">
        <field>LastName</field>
        <list>
          <constant type="String" null="0">Fuller</constant>
          <constant type="String" null="0">King</constant>
          <constant type="String" null="0">Test</constant>
        </list>
      </binaryoperation>
    </binaryoperation>
  </where>
</query>


Da-48.png

Product: RemObjects Data Abstract
Available Editions: Data Abstract for .NET, Delphi and Xcode

GlossaryArchitectureArticlesFeaturesLibrarySamples

Navigation
products
hubs
special
Toolbox