Thursday, March 22, 2012

Calculated field in dataset using Previous() function

Hi,
Iam trying to add a calculated field to my report dataset which based on
value of a field in the previous row. The calculated field is defined as
=IIf(Previous(Fields!Col1.Value)=Fields!Col1.Value,0,CDbl(Fields!Col2.Value)+CDbl(Fields!Col3.Value))
. Iam basically checking the value of Col1 in previous row with value in
current row. Iam getting the following error when tried to build the report
"An internal error occurred on the report server. See the error log for more
details.". I could not find anything in error log.
Can anyone help in resolving this problem ?
Thanks,
RKOn Dec 3, 1:35 am, "S V Ramakrishna"
<ramakrishna.seeth...@.translogicsys.com> wrote:
> Hi,
> Iam trying to add a calculated field to my report dataset which based on
> value of a field in the previous row. The calculated field is defined as
> =IIf(Previous(Fields!Col1.Value)=Fields!Col1.Value,0,CDbl(Fields!Col2.Value-)+CDbl(Fields!Col3.Value))
> . Iam basically checking the value of Col1 in previous row with value in
> current row. Iam getting the following error when tried to build the report
> "An internal error occurred on the report server. See the error log for more
> details.". I could not find anything in error log.
> Can anyone help in resolving this problem ?
> Thanks,
> RK
I found that the Previous(Fields!XYZ.Value) function only works in the
Table and Matrix expressions -- expresions that are evaluated at
render time. Although it would make sense to have them in the DataSet
as a calculated field, I've not been able to get this to work.
Oracle has LAG and LEAD functions that return the previous/next value
of a Field as part of the query results. Microsoft T-SQL does not
have an equivalent.
-- Scottsql

No comments:

Post a Comment