Posted by (JavaScript must be enabled to view this email address) on Wed 18 Nov 2009

Today we had an issue with a report and its related subreport in CRM 4.0, specifically that the report wouldn’t run and we were receiving the following message…

  1.  
  2. "The sub report could not be shown"
  3.  

Looking at the reporting services log on the server, we could see the following error, leading us to believe that the problem was a result of a date field being passed between the main report and its related sub-report, ...

  1.  
  2. w3wp!processing!7!11/17/2009-08:53:56::
  3. e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Cannot read the next data row for the data set _MSCRM., ;
  4. Info: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Cannot read the next data row for the data set _MSCRM.
  5. ---> System.Data.SqlClient.SqlException: Arithmetic overflow error converting expression to data type datetime.
  6.  

This problem however was only being experienced on certain machines. Looking at the specifics of these machines we could see that the machines affected were those who had their CRM Current Format set as English (United Kingdom), those machines who had their current format as the default English (United States) could run the report without any issue.

The only date related functionality we had in the report was a string parameter in the main report which held a date value, this was being passed from the main report to the sub-report and was used to compare against a datetime field in the sub-report. The source dataset of the date string parameter was as follows…

  1.  
  2. DECLARE @DateRange AS Table
  3. (
  4. Period VARCHAR(14),
  5. EndDate DATETIME
  6. )
  7.  
  8. INSERT INTO @DateRange (Period, EndDate)
  9. VALUES('Current Month', DATEADD(WEEK, 3, GETDATE()))
  10.  
  11. SELECT EndDate FROM @DateRange
  12. WHERE Period = 'Current Month'
  13.  

Looking at the above sql I could see that the datetime value was being pulled directly from the sql (therefore it would be in american format, potentially causing issues on british format CRM browsers), so I therefore decided to change this to ensure the date was in the more generic ISO format of yyyymmdd.
I therefore changed the SQL to the below, replacing one line with a CONVERT statement, shown below…

  1.  
  2. DECLARE @DateRange AS Table
  3. (
  4. Period VARCHAR(14),
  5. EndDate DATETIME
  6. )
  7.  
  8. INSERT INTO @DateRange (Period, EndDate)
  9. VALUES('Current Month', DATEADD(WEEK, 3, GETDATE()))
  10.  
  11. SELECT CONVERT(varchar,EndDate,112) AS EndDate
  12. FROM @DateRange
  13. WHERE Period = 'Current Month'
  14.  

After modifying the dataset as per the above and re-uploading the report it worked without issue, as I had removed the dependancy on an American date format which didn’t agree with any English (United Kingdom) format CRM browsers.



Posted by (JavaScript must be enabled to view this email address) on Tue 28 Jul 2009

The first thing to do is get the current month:


  1. SET @CurrentDate = GetDate()SET @CurrentMonth = Month(@CurrentDate)

Then its just a case of setting the start and end of the fiscal year according to whether the month falls in the last quarter (Jan, Feb, Mar) or the first three quarters (April thru to Dec):

  1. IF @CurrentMonth >= 4
  2. BEGIN
  3. SET @FiscalYearStart = DATEADD(mm, 3, DATEADD(yyyy, DATEDIFF(yyyy, 0, @CurrentDate), 0))
  4. SET @FiscalYearFinish = DATEADD(mm, -1, DATEADD(yyyy, 1, @FiscalYearStart))
  5. END
  6. ELSE
  7. BEGIN
  8. SET @FiscalYearStart = DATEADD(mm, -9, DATEADD(yyyy, DATEDIFF(yyyy, 0, @CurrentDate), 0))
  9. SET @FiscalYearFinish = DATEADD(mm, -1, DATEADD(yyyy, 1, @FiscalYearStart))
  10. END

Hope this helps you in your report building duties full code below:

  1. Declare @CurrentDate AS DateTime
  2. Declare @CurrentMonth AS int
  3. Declare @FiscalYearStart AS DateTime
  4. Declare @FiscalYearFinish AS DateTime
  5. SET @CurrentDate = GetDate()
  6. SET @CurrentMonth = Month(@CurrentDate)
  7. IF @CurrentMonth >= 4
  8. BEGIN
  9. SET @FiscalYearStart = DATEADD(mm, 3, DATEADD(yyyy, DATEDIFF(yyyy, 0, @CurrentDate), 0))
  10. SET @FiscalYearFinish = DATEADD(mm, -1, DATEADD(yyyy, 1, @FiscalYearStart))
  11. END
  12. ELSE
  13. BEGIN
  14. SET @FiscalYearStart = DATEADD(mm, -9, DATEADD(yyyy, DATEDIFF(yyyy, 0, @CurrentDate), 0))
  15. SET @FiscalYearFinish = DATEADD(mm, -1, DATEADD(yyyy, 1, @FiscalYearStart))
  16. END
  17. SELECT @FiscalYearStart, @FiscalYearFinish



Posted by (JavaScript must be enabled to view this email address) on Tue 21 Jul 2009

As the impact of swine flu on businesses increases and the NHS predicts a significant effect on business in autumn 2009, we would like to reassure you that Brantas is working proactively to prevent any impact on your business.

To ensure we continue to deliver within the SLAs in our support agreements, we are taking the following preventative actions:

  • Environmental
  • Organisational
  • Individual behaviour

For more information please download the Brantas approach taken minimising the impact on our employees and customers.



Page 1 of 2 pages  1 2 >

About our Blog

Brantas Limited specialise in Dynamics CRM, SharePoint and System Integration using the Microsoft Platform. We are all experienced developers in various fields with our own specialities complementing those of our team.

We have been working with SharePoint since 2003, including Installation and Administration, Migration, Development and Support.

RSS Feed