Thursday, April 9, 2015

Calculation on RDLC Report in Ms Visual Studio 2008

At report design time, you might need some calculation directly on report design otherwise you need coding first and apply result on report. Here, I will show all report developer on how to reference a cell value for calculation on another cell of a table. Now let see an example of table below:


Field 1 Field 2 Field 3 Field 4 Field 5 Field 6 Field 7
No Item ID Item Name Unit Qty Price Total
1 001 AAA Pcs 10.00 2.00 20.00
2 002 BBB Pcs 20.00 4.00 80.00
3 003 CCC Pcs 30.00 6.00 180.00
4 004 DDD Pcs 40.00 8.00 320.00
5 005 EEE Pcs 50.00 10.00 500.00
6 006 FFF Pcs 60.00 12.00 720.00
7 007 GGG Pcs 70.00 14.00 980.00
8 008 HHH Pcs 80.00 16.00 1,280.00
9 009 III Pcs 90.00 18.00 1,620.00
10 010 JJJ Pcs 100.00 20.00 2,000.00




Sub Total 7,700.00




VAT 10% 770.00




Total 8,470.00

As you see in above table you might need to apply formula in some cell such as:
Sub Total
- Basic formula:
                  Sub Total = Sum(Total)
- RDLC Report in Ms Visual Studio Formula:
                  =Sum(Fields!Total.Value)

VAT 10%
- Basic formula:
                  VAT 10% =Sub Total * 0.1
- RDLC Report in Ms Visual Studio Formula:
                  =ReportItems!Sub Total Field Name.Value * 0.1
Total
- Basic formula:
                  Total = Sub Total + VAT 10%
- RDLC Report in Ms Visual Studio Formula:
                  =ReportItems!Sub Total Field Name.Value * 1.1

No comments:

Post a Comment