Wednesday, March 21, 2012

Is this doable?

On the report table, there are 3 fields called Beginning Amount, Used Amount
and Remaining Amount respectively. The Beginning Amount and Used Amount field
are retrieved from the SQL database, while the Remaining Amount needs to be
calculated from the previous record, e.g, ItemB's RemainingAmount = ItemA's
RemainingAmount - ItemB's UsedAmount. Basides subreport and global variable,
is there any easy way to do it? what is a good approach here?
Example,
Beginning Amount: $1000
============================================== Name Used Amount Remaining Amount
============================================== Item A 100 900
Item B 200 700
Item C 100 600
Thanks.
ShawnYes it is doable with the RunningValue function.
See BOL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_expressions_v1_5tt1.asp
The remaining amount would be e.g.:
= 1000 - RunningValue(Fields!Amount.Value, Sum, Nothing)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sean" <Sean@.discussions.microsoft.com> wrote in message
news:7E302ED6-E26D-4307-A190-F2573050CD85@.microsoft.com...
> On the report table, there are 3 fields called Beginning Amount, Used
Amount
> and Remaining Amount respectively. The Beginning Amount and Used Amount
field
> are retrieved from the SQL database, while the Remaining Amount needs to
be
> calculated from the previous record, e.g, ItemB's RemainingAmount =ItemA's
> RemainingAmount - ItemB's UsedAmount. Basides subreport and global
variable,
> is there any easy way to do it? what is a good approach here?
>
> Example,
> Beginning Amount: $1000
> ==============================================> Name Used Amount Remaining Amount
> ==============================================> Item A 100 900
> Item B 200 700
> Item C 100 600
> Thanks.
> Shawn
>|||Robert Bruckner [MSFT] wrote:
> Yes it is doable with the RunningValue function.
> See BOL:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_expressions_v1_5tt1.asp
> The remaining amount would be e.g.:
> = 1000 - RunningValue(Fields!Amount.Value, Sum, Nothing)
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Sean" <Sean@.discussions.microsoft.com> wrote in message
> news:7E302ED6-E26D-4307-A190-F2573050CD85@.microsoft.com...
>>On the report table, there are 3 fields called Beginning Amount, Used
> Amount
>>and Remaining Amount respectively. The Beginning Amount and Used Amount
> field
>>are retrieved from the SQL database, while the Remaining Amount needs to
> be
>>calculated from the previous record, e.g, ItemB's RemainingAmount => ItemA's
>>RemainingAmount - ItemB's UsedAmount. Basides subreport and global
> variable,
>>is there any easy way to do it? what is a good approach here?
>>
>>Example,
>>Beginning Amount: $1000
>>==============================================>>Name Used Amount Remaining Amount
>>==============================================>>Item A 100 900
>>Item B 200 700
>>Item C 100 600
>>Thanks.
>>Shawn
>>
>
>
RunningValue solves it.sql

No comments:

Post a Comment