Date Format

  • Using the 'Action' property to drilldown to another report but receiving the following error message.  Browsing the internet, this error is related to incorrect formatting of the date, but I have tried all formats available.

    The value provided for the report parameter 'Date' is not valid for its type. (rsReportParameterTypeMismatch)

    Using expression I am passing  =FORMAT(Fields!Date.Value, "dd/MM/yyyy" while the target report param has a type of DATE/TIME and accepts dd/MM/yyyy.

    Which is the best way to determine the format required?

    Any help would be appreciated.

  • SQLMan1 - Monday, June 18, 2018 9:05 AM

    Using the 'Action' property to drilldown to another report but receiving the following error message.  Browsing the internet, this error is related to incorrect formatting of the date, but I have tried all formats available.

    The value provided for the report parameter 'Date' is not valid for its type. (rsReportParameterTypeMismatch)

    Using expression I am passing  =FORMAT(Fields!Date.Value, "dd/MM/yyyy" while the target report param has a type of DATE/TIME and accepts dd/MM/yyyy.

    Which is the best way to determine the format required?

    Any help would be appreciated.

    Parameters provided by means other than the users typing them in (where SSRS will turn the typing into the proper data type) have to actually be of the proper data type, so simply formatting a date value isn't going to work, because the expectation is a date value.   A string is NOT a date value, even if it's formatted that way.  You probably need to just get rid of the format function altogether, but without seeing all the details of your report and subreport, there's no way to be 100% certain.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Thank you - After your direction I re-analysed the query and spotted a CONVERT statement with varchar.  Changed from varchar to date and time respectively and this worked for the drill down.

    From:

    CONVERT(varchar(20),DateSampled) as 'Date',

    LEFT(CONVERT(varchar(20),DateSampled,8),5) as 'Time',

    To:

    CONVERT(date, DateSampled) as 'Date',

    LEFT(CONVERT(time, DateSampled,8),5) as 'Time',

  • SQLMan1 - Tuesday, June 19, 2018 6:42 AM

    Thank you - After your direction I re-analysed the query and spotted a CONVERT statement with varchar.  Changed from varchar to date and time respectively and this worked for the drill down.

    From:

    CONVERT(varchar(20),DateSampled) as 'Date',

    LEFT(CONVERT(varchar(20),DateSampled,8),5) as 'Time',

    To:

    CONVERT(date, DateSampled) as 'Date',

    LEFT(CONVERT(time, DateSampled,8),5) as 'Time',

    Glad I could help.   Sometimes, ya just need a second set of eyes to see what we too often can't because we're too close to it.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply