Inconsistent error in report

  • Hi All,

    I have a weird problem with a report I've written (using Visual Studio 2015).
    I have a Shared Dataset which runs a Stored Procedure that accepts StartDate and EndDate parameters. In the Report parameters properties these parameters have a Data Type of Date/Time.
    I want to display the user selected date range at the top of the report and have created a Textbox with [@StartDate.Label] and [@EndDate.Label]
    When I run the report it works but displays the date AND time.
    I only want the date displayed so I right clicked on the dates in the Text box and set the expressions to :

    =FormatDateTime(Parameters!StartDate.Label, DateFormat.ShortDate) and

    =FormatDateTime(Parameters!EndDate.Label, DateFormat.ShortDate)


    This is where it gets inconsistent.... When I run the report, the "Start Date" displays as required but the "End Date" displays as #Error and there's the following warning in the Error List:

    "The Value expression for the textrun ‘Textbox12.Paragraphs[2].TextRuns[3]’ contains an error: Conversion from string "30/11/2016 00:00:00" to type 'Date' is not valid."

    What's confusing me is why is the Start Date working but the End Date isn't when they are virtually identical ? Any ideas ?

  • IGNORE.
    I had a moment of clarity.
    Still not entirely sure why this behavior happened, but by changing the expression from "Label" to "Value" it now works perfectly.

    Eg: =FormatDateTime(Parameters!EndDate.Value, DateFormat.ShortDate)

Viewing 2 posts - 1 through 2 (of 2 total)

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