CRM 2011 Reporting: Showing Date-Only in a datetime field

Let’s say I have a report of my CRM leads that looks like this:

image

Very simple, just name, created on date, and their email address.  The only problem is that I could really care less what time they were created, I just need the date.  Here’s how you fix that issue:

Export the report

The first step in this process is to export the report so that you may modify the file.

Edit the report then selection Actions, Download report:

image

When Prompted, select Save, and save the report into a folder that you can easily remember.

 

Edit the report

Next you need to edit the report in your favorite XML editor.  I am using Visual Studio 2010.

You need to locate the datetime field within the XML file:

<Textbox Name="Table0_Details1">
  <CanGrow>true</CanGrow>
  <Value>=Fields!createdon.Value</Value>
  <Action>
    <Hyperlink>=Nothing</Hyperlink>
  </Action>
  <Style>
    <Calendar>=Parameters!CRM_CalendarTypeCode.Value</Calendar>
    <Language>=Microsoft.Crm.Reporting.RdlHelper.ReportCultureInfo.GetCultureName(
               Parameters!CRM_UILanguageId.Value)</Language>
    <TextAlign>Right</TextAlign>
    <FontFamily>Tahoma</FontFamily>
    <FontSize>8pt</FontSize>
    <PaddingBottom>2pt</PaddingBottom>
    <PaddingLeft>2pt</PaddingLeft>
    <PaddingRight>2pt</PaddingRight>
    <PaddingTop>2pt</PaddingTop>
  </Style>
</Textbox>

You need to change the highlighted line above to read:

<Value>=Format(CDate(Fields!createdon.Value), "MM/dd/yyyy") </Value>

 

Save the file.

 

Import the modified report

Back in CRM, you need to import the report file. 

Change the report type to Existing file.

Click the Browse button and select your .rdl file:

image

Click the Save button to save the updated report into CRM.

 

Preview the new report

Here is a preview of the new report with the modified date:

image

Leave a Reply 1 comment