Wednesday, March 7, 2012

Expression for visibility of a chart

Hi,

I wrote the following expression in the visibility(Hidden) property of a chart.

=Iif(DateDiff("Hour",Parameters!StartDate.Value ,Parameters!EndDate.Value)< 24,False,True)

And it is giving me the following error.

An error occured during local report processing.

The Hidden expression for the chart 'chart1' contains an error: Argument 'Interval' is not a valid value.

What is the problem?

Sincerely,

Amde

Is the report parameters' data type defined as DateTime?

Try this:
=Iif(DateDiff("h", CDate(Parameters!StartDate.Value), CDate(Parameters!EndDate.Value)) < 24,False,True)

-- Robert

|||

Yes! Now it is working. The thing is I tried by adding the CDate function, but the problem is with the interval value.

In the books oline it is documented to use the following interval: Year, Quarter, Month, Day, Hour, Minute, Second, or Week for the DateAdd and DateDiff functions. Why is this not working?

Amde

|||

The interval value must be either an enum value or a string value.

You have to use either DateInterval.Hour (enum value) or "h" (string value) for the first argument of the DateDiff function.

-- Robert

No comments:

Post a Comment