Monday, 1 October 2012


FetchXML syntax:


Legend:

          Xxxx :=   à production

          (   ) à choice

          | à or

          ? à optional

          * à repeat

// à comments

 

FetchXml :=

  <fetch

    (page='page-number')? // start page default is 0

    (count='items-per-page')? // count default is 5000

    (utc-offset='utc-offset')? // utc-offset default is 0

    (mapping='logical')?

    (distinct = ('true' | 'false' | '1' | '0') )? //default false

    (paging-cookie='page-cookie')?

   >

    <entity name='entity-name'>

    Entity-Xml

    </entity>

  </fetch>

 

 Example:

<fetch page=‘10’ count=‘50’ distinct=‘true’

     page-cookie=‘Page1’>

    <entity name=‘account’ >

    …. Put Entity-Xml here ….

    </entity>

</fetch>

 

 

 

          Entity-Xml :=

          (<all-attributes/> | <no-attrs/> |Attribute-Xml* )

            ( Filter-Xml |  LinkEntity-Xml |  Order-Xml )*

          Attribute-Xml :=

            <attribute name='attr-name'

              (aggregate=(AggOp) alias='alias-name')?

            />

          AggOp :=

          (avg | min | max | count(*) |count(attribute name))

          Filter-Xml :=

            <filter (type= ('or' | 'and'))? // default is 'and'  >

            ( Condition-Xml | Filter-Xml )*

            </filter>

           

          LinkEntity-Xml :=

            <link-entity name = 'entity-name'

              // to is the column on the remote entity

              (to = 'column-name')? 

              // from is the column on the local entity

              (from = 'column-name')? 

              (alias = 'table-alias')?

              (link-type = ('natural' | 'inner' | 'outer'))?

            >

            Entity-Xml

            </link-entity>

          Order-Xml :=

            <order attribute='attr-name'

              (descending= ('true' | 'false' | '1' | '0')?

            />