locked
Date/Time format for Webservice API calls RRS feed

  • Question

  • Hi,

     

    I want to retrieve some parameter values from Reporting Services using GetReportParameters from

    Microsoft.SqlServer.ReportingServices.ReportService2005.

    It works fine unless the parameter types are date/time. In such a case it seems as if the format of the parameter depends on the ReportServices installation:

     

    Example:

    On a German installation the date/time format is "dd.mm.yyyy" but on an English installation the format is different (mm/dd/yyyy) (and of course the time part is also different).

     

    Is there a way to determine the format to be expected?  (... even in the case I've no knowledge about the server ReportingServices is running.)

    Tuesday, February 5, 2008 7:59 PM

Answers

  • Hi,

    These values are most likely in the regional settings for the SSRS machine.  You could create a SQL CLR stored procedure which reads these values out of the registry and then have your custom app call this procedure to initialize its metadata on startup.

    Hope this helps,
    Bill
    Tuesday, February 12, 2008 9:25 PM

All replies

  • Hi,

     

    If your issue is that date parameters be interpreted by Reporting Services regardless of the installation language, you can pass a neutral format such as yyyy-mm-dd which should be parsed correctly by both German and English installations.

     

    Hope this helps,

    Bill

     

    Wednesday, February 6, 2008 10:28 AM
  • Hi Bill,

    thx for your answer.
    It is not exactly a solution to the problem I have: I'd like to have a method to know which date/time format Reporting Services is using for the messages used for setting up the cascading parameters. Furthermor I'd like to know the decimal separator also.
    I want to know these things because we're using a custom application which enables the user to input report parameters and for some reasons we can't use the default parameter input feature SSRS is offering.

    Any Ideas?
    Johann
    Monday, February 11, 2008 9:20 PM
  • Hi,

    These values are most likely in the regional settings for the SSRS machine.  You could create a SQL CLR stored procedure which reads these values out of the registry and then have your custom app call this procedure to initialize its metadata on startup.

    Hope this helps,
    Bill
    Tuesday, February 12, 2008 9:25 PM
  • I think I have discovered a way to control the datetime format (and possibly other formats) when using the Reporting Services 2005 SOAP API. You need to create a partial class alongside the generated ReportingService class and override the GetWebRequest method, then add an Accept-Language header to the Web request. Here is a sample class:

     

    Code Snippet

    public partial class ReportingService

    {

      /// <summary>

      /// Gets or sets the culture that is used when generating the report.

      /// </summary>

      /// <value>The culture that is used when generating the report.</value>

      public CultureInfo Culture { get; set; }

      protected override WebRequest GetWebRequest(Uri uri)

      {

        WebRequest request = base.GetWebRequest(uri);

        CultureInfo culture = this.Culture ?? CultureInfo.CurrentCulture;

        request.Headers.Add(HttpRequestHeader.AcceptLanguage, culture.Name);

        return request;

      }

    }

     

     

    This appears to affect the datetime format on a parameter's ValidValues property, on the parameter values that you supply when generating the report, and also on downloaded reports.

     

    Hope this helps.

    • Proposed as answer by tvoigt Monday, November 28, 2011 4:20 PM
    Wednesday, November 12, 2008 9:41 AM