locked
Fetchxml, 'actual end,' parameters and sorting RRS feed

  • Question

  • Below is my fetchxml:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
      <entity name="account">
        <attribute name="name" />
        <attribute name="accountid" />
        <order attribute="name" descending="false" />
        <link-entity name="activitypointer" from="regardingobjectid" to="accountid" alias="aa">
    <attribute name="actualend"/>
          <filter type="and">
            <condition attribute="statecode" operator="eq" value="1" />
            <condition attribute="activitytypecode" operator="in">
              <value>4202</value>
              <value>4207</value>
              <value>4210</value>
          <condition attribute="actualend" operator="on-or-after" value="@CRM_DATE" />
            </condition>
          </filter>
        </link-entity>
      </entity>
    </fetch>

    1)It returns (for whatever reason) both aa_actualend and aa_actualendValue.  What's the difference first of all?  They seem to have close but different values.


    2) no matter how I put in the parameter (as text, as auto, with quotes, without quotes, 2016-01-01 or 12/4/2015) it never works.  I still seem to return everything.

    3) even when I take out the parameter and hard code the date, it still returns everything.


    Suggestions?

    Monday, January 19, 2015 6:16 PM

All replies

  • Hello,

    1. aa_actualend is text field (this is a display text for your datetime field) and aa_actualendValue contains real value of a field (datetime value).

    2. Try to use DateTime parameter in a report instead of string.

    3. Try to look attentively on your query - it is not correct. It should be something like following instead of query you've provided:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
      <entity name="account">
        <attribute name="name" />
        <attribute name="accountid" />
        <order attribute="name" descending="false" />
        <link-entity name="activitypointer" from="regardingobjectid" to="accountid" alias="aa">
    <attribute name="actualend"/>
          <filter type="and">
            <condition attribute="statecode" operator="eq" value="1" />
            <condition attribute="actualend" operator="on-or-after" value="@CRM_DATE" />
            <condition attribute="activitytypecode" operator="in">
              <value>4202</value>
              <value>4207</value>
              <value>4210</value>
            </condition>
          </filter>
        </link-entity>
      </entity>
    </fetch>


    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Monday, January 19, 2015 7:06 PM
    Moderator
  • Thanks.

    I will compare the two queries.

    Monday, January 19, 2015 7:22 PM