FetchXML 2011 -Total Record Count

Fetch in 2011 has added some really nice features.  One of those nice features is the total record count of the applied filter.  In 4.0 you had to execute two fetch statements, but now with 2011 you can add the ReturnTot alRecordCount attribute.

<fetch mapping='logical' count='25' returntotalrecordcount='true'>
   <entity name='account'>
      <attribute name='accountid' />
      <attribute name='accountnumber' />
      <attribute name='address1_city' />
      <attribute name='address1_telephone1' />
      <attribute name='name' />
      <order attribute='name' />
      <filter>
         <condition attribute='address1_city' operator='like' value='Greenville%' />
      </filter>
   </entity>
</fetch>

 

Upon executing this fetch statement with the ReturnTotalRecordCount  attribute set to true, the “TotalRecordCount” is returned.

image

Note: This is not the total number of entities, it is the total number of records that match the filter.

Post by: Paul Way, Customer Effective

1 thought on “FetchXML 2011 -Total Record Count”

  1. I need to get a record count in a similar way to this, i have the fetchXML but i dont know how to execute it and place it into a variable, can you help?

Comments are closed.

Show Buttons
Hide Buttons