Note: This article/demonstration is based on SSRS 2008. The options should be almost the same in SSRS 2005 as well.
Please visit http://dattatreysindol.blogspot.com for all updates from now on.
Thanks for visiting my blog.
- Datta
Note: This article/demonstration is based on SSRS 2008. The options should be almost the same in SSRS 2005 as well.
- XML file with report data
- CSV (comma delimited)
- Acrobat (PDF) file
- MHTML (web archive)
- Excel
- TIFF file
- Word
We often use Remote Desktop Connection (RDC) for connecting to Development/Test/UAT Servers for various activities like Development, Testing, Deployments etc. People also refer to this in short as RDC/RDP/TS (Terminal Services Connection) etc.Today I was approached by one of my colleagues who wanted to adjust the window size of the Remote Desktop Connection. At first even I did not know how to adjust the window size, but after spending a couple minutes I got it working :-)
- Click on Start -> Run
- Type "mstsc" and click "OK". This will open the Remote Desktop Connection dialog box.
- Click on "Options>>" in the right bottom corner of this dialog box.
- Click on the "Display" tab.
- In the Display tab adjust the pointer towards "Less" to reduce the size of the RDC window and towards "More" to increase the size of the RDC window. Keeping it at "More" will create open a Full Screen window so that the user can exclusively work in the remote desktop/server and can navigate between the windows in the RDC connection using "ALT + TAB".
- Click on "Connect" and enter the credentials and hit Enter to connect to the remote desktop/server.
SQL Server Reporting Services (SSRS) is a great BI tool offering lot of powerful features. SSRS 2008 has lot more features and is much more powerful than SSRS 2005. Irrespective of whether its SSRS 2005 or SSRS 2008, there are many features common between the two versions. Functions are one such powerful options/capabilities in SSRS.
In this article I will present detailed steps for the use of Functions in SSRS.
Often in reporting/BI projects using SSRS we use lot of calculations/expressions in many fields in the reports. There are scenarios where in same formula/calculations is used across many fields in the report. Functions come in handy especially in this kind of scenarios.
Let us take a look at this sample report with simple calculations for finding Sum, Difference, Product & Percentage.
Create an SSRS report with the following query in the dataset:
SELECT 1 AS ColumnA, 2 AS ColumnB
UNION ALL
SELECT 3 AS ColumnA, 4 AS ColumnB
UNION ALL
SELECT 5 AS ColumnA, 6 AS ColumnB
UNION ALL
SELECT 7 AS ColumnA, 8 AS ColumnB
UNION ALL
SELECT 9 AS ColumnA, 10 AS ColumnB
UNION ALL
SELECT 11 AS ColumnA, 12 AS ColumnB
UNION ALL
SELECT 13 AS ColumnA, 14 AS ColumnB
UNION ALL
SELECT 15 AS ColumnA, 16 AS ColumnB
UNION ALL
SELECT 17 AS ColumnA, 18 AS ColumnB
UNION ALL
SELECT 19 AS ColumnA, 20 AS ColumnB
Now lets drop a Table object on to the report designer with the following six fields as shown in the below screenshot.
- Column A
- Column B
- Sum of A & B
- Difference of A & B
- A Multiplied by B
- A as a % of B
' Function for Addition
Function GetSum(ByVal A AS Integer, ByVal B AS Integer) As Integer
Dim VarSum AS Integer
VarSum = A + B
Return VarSum
End Function
' Function for Difference
Function GetDiff(ByVal A AS Integer, ByVal B AS Integer) As Integer
Dim VarDiff AS Integer
IF (A>=B) THEN
VarDiff = A - B
ELSE
VarDiff = B - A
END IF
Return VarDiff
End Function
' Function for Multiplication/Product
Function GetProduct(ByVal A AS Integer, ByVal B AS Integer) As Integer
Dim VarProduct AS Integer
VarProduct = A * B
Return VarProduct
End Function
' Function for Percentage
Function GetPercent(ByVal A AS Integer, ByVal B AS Integer) As Integer
Dim VarPercent AS Integer
VarPercent = (A/B)*100
Return VarPercent
End Function
Enter the following expressions in the detailed row of the report for the six fields as shown in the below screenshot.
Expr1: "=Fields!ColumnA.Value"
Expr2: "=Fields!ColumnB.Value"
Expr3: "=Code.GetSum(Fields!ColumnA.Value,Fields!ColumnB.Value)"
Expr4: "=Code.GetDiff(Fields!ColumnA.Value,Fields!ColumnB.Value)"
Expr5: "=Code.GetProduct(Fields!ColumnA.Value,Fields!ColumnB.Value)"
Expr6: "=CStr(Code.GetPercent(Fields!ColumnA.Value,Fields!ColumnB.Value)) + " %""
Now go to the Preview tab and check out the results as shown in the below screenshot.
And the results are amazing. Having functions for scenarios where the same calculation is used in many places in a report is really helpful and makes the code more modular & neat.
Note: This has been tested & presented as per SSRS 2008.
If you find this post helpful then feel free to leave a comment below :-)
Many times we will be working on server by doing a Remote Desktop Connection/Terminal Services Connection. Several times there is a need for opening multiple instances of the same application with a different UserID.
- Type the following command on Command Prompt and Hit Enter.
- You will be prompted to enter the password for the account "Learning\Datta". Enter the password and Hit Enter.
- This opens up SQL Server Management Studio with the account "Learning\Datta".



