Hello Friends,
I have identify some of the very useful VB Script function in RDLC Report which helps many times to design reports in RTC reports.
1) Percentage calculation using function in VB Script code (Copy from standard USA 10048 Report)
I have identify some of the very useful VB Script function in RDLC Report which helps many times to design reports in RTC reports.
1) Percentage calculation using function in VB Script code (Copy from standard USA 10048 Report)
In class version there is code in on section trigger to
calculate the percentage
Shared Pct as Decimal
Public Function CalcPct(Amount as Decimal,
Profit as Decimal) as Decimal
if Amount <> 0
then
Pct =
100 * Profit / Amount
else
Pct = 0
end if
REM Rounding precision =
0.1
Return ROUND(10*Pct)/10
End
Function
In the Textbox expression define the following expression
2) Get
the Unit Cost value by divide Amout by Qty using VB Script Function (Use in
Standard NA 10139 Report)
Note:
If you directly divide the value in expression than RDLC Report is failed to Handle Divide by Zero exception
Not Working --- IIF(Fields!UnitCost.Value <> 0, Fields!Amount.Value/Field.UnitCost.Value,0)
Define the function in report:
Public Function
CalcUnitCost(Inventory as Decimal, Remaining as Decimal)
if Remaining = 0 then
return 0
end if
return Inventory/ Remaining
End Function
Expression: =Code.CalcUnitCost(Sum(Fields!InventoryValue.Value),Sum(Fields!RemainingQty.Value))
3) Comment
in VB Script function
Use the ‘ (single quote) to write comment in function
i will update the more useful function very soon.
I hope it will help you in future.
Keep Sharing...Keep Growing !!!
tere lie jhumma jhumma chumma
ReplyDelete