locked
How to get Datepart for date field or attribute in CRM2011 and FetchXML RRS feed

  • Question

  • I need to develop one report where i need Year .

    can i get only datepart for date field(attribute ) ?

    ex.as in simple SQl statement ,

    Select DATEPART( Year , getdate() ) It will give me current year .

    Similarly i want to get year part for below FetchXML .

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
      <entity name="cms_mytable">

              <attribute name="cms_mydate" />

      </entity>
    </fetch>

    I don't need it in JavaScript or C#/VB script code. i mean i am trying it on FetchXML results only .

    any help would be much appreciate.

    Thursday, January 16, 2014 12:50 AM

Answers

  • Hi,

    No need to handle this requirement in FetchXml. Just build your Fetch as usual, then in your report when you want to show the date or time, give it a format using the reporting service capabilities. Right click on the column or cell and define your expression about the date (month, year, date, datetime,...).

    Thursday, January 16, 2014 6:12 AM
    Moderator

All replies

  • Hi,

    I don't think MS support that feature. You can check the FetchXML xsd file. There's no additional attribute in "attribute element" to transform attribute data. Also there's no other element you can use to retrieve data except attribute element.

    Thursday, January 16, 2014 4:16 AM
  • Hi,

    No need to handle this requirement in FetchXml. Just build your Fetch as usual, then in your report when you want to show the date or time, give it a format using the reporting service capabilities. Right click on the column or cell and define your expression about the date (month, year, date, datetime,...).

    Thursday, January 16, 2014 6:12 AM
    Moderator