Lesson 6: Working with expressions in SSRS (Tutorial)
Click on Report in menu bar and select Report Properties.
Public Shared Function SetColor(ByVal TicketPrice As Integer) As String
SetColor= "Transparent"
If TicketPrice >= 200 Then
SetColor= "Green"
End IF
End Function
=Code.SetColor(Fields!Price.Value)
Preview the report.
Type below functions in the report properties window as in earlier step.
'Function to set the font weight as bold
Public Shared Function SetBoldFontWeight(ByVal TicketPrice As Integer) As String
SetBoldFontWeight= "Default"
If TicketPrice >= 200 Then
SetBoldFontWeight= "Bold"
End IF
End Function
'Function to set the font weight as italic
Public Shared Function SetItalicFontWeight(ByVal TicketPrice As Integer) As String
SetItalicFontWeight= "Default"
If TicketPrice >= 200 Then
SetItalicFontWeight= "Italic"
End IF
Right click on Title column and select the text box properties option.
In text box properties, navigate to Font tab. Click the expression button for Bold and type the below code in expressions dialog window.
Type below functions in the report properties window as in earlier step.
'Function to set the font weight as bold
Public Shared Function SetBoldFontWeight(ByVal TicketPrice As Integer) As String
SetBoldFontWeight= "Default"
If TicketPrice >= 200 Then
SetBoldFontWeight= "Bold"
End IF
End Function
'Function to set the font weight as italic
Public Shared Function SetItalicFontWeight(ByVal TicketPrice As Integer) As String
SetItalicFontWeight= "Default"
If TicketPrice >= 200 Then
SetItalicFontWeight= "Italic"
End IF
End Function
In text box properties, navigate to Font tab. Click the expression button for Bold and type the below code in expressions dialog window.
=Code.SetBoldFontWeight(Fields!Price.Value)
Conclusion:
We can make use of expression in almost everywhere in SSRS for various purposes.
Related topics:
Lesson 1: CREATE A SIMPLE SSRS REPORT (TUTORIAL)
Lesson 2: CREATE A SSRS REPORT WHICH EXCEPTS INPUT PARAMETER (TUTORIAL)
Lesson 3: CREATE DRILL DOWN VIEW IN SSRS (TUTORIAL)
Lesson 4: NAVIGATING BETWEEN SSRS REPORTS (TUTORIAL)
Lesson 5: WORKING WITH SUB REPORT IN SSRS (TUTORIAL)
Lesson 7: WORKING WITH GRAPHS AND INDICATOR IN SSRS (TUTORIAL)
Lesson 8: MISCELLANEOUS OPTIONS IN SSRS (TUTORIAL)
Related topics:
Lesson 1: CREATE A SIMPLE SSRS REPORT (TUTORIAL)
Lesson 2: CREATE A SSRS REPORT WHICH EXCEPTS INPUT PARAMETER (TUTORIAL)
Lesson 3: CREATE DRILL DOWN VIEW IN SSRS (TUTORIAL)
Lesson 4: NAVIGATING BETWEEN SSRS REPORTS (TUTORIAL)
Lesson 5: WORKING WITH SUB REPORT IN SSRS (TUTORIAL)
Lesson 7: WORKING WITH GRAPHS AND INDICATOR IN SSRS (TUTORIAL)
Lesson 8: MISCELLANEOUS OPTIONS IN SSRS (TUTORIAL)












No comments:
Post a Comment