In the Classic client, you can use the BlankNumbers and BlankZero functions for formatting.
-
The BlankNumbers function determines whether a range of numbers will be set to blank.
-
The BlankZero function determines whether a field appears blank if the value is 0 (zero) or true.
In the RoleTailored client, the BlankNumbers and BlankZero functions do not exist by default. If you create a client report definition (RDLC) report layout for a report in which BlankNumbers or BlankZero are used in the Classic layout, then the new report layout includes the following functions and you do not need to modify the layout:
-
BlankZero
-
BlankPos
-
BlankNeg
-
BlankZeroAndPos
-
BlankNegAndZero
If you create an RDLC report layout for a report in which the BlankNumbers or BlankZero functions are not used in the Classic report layout, then you do not get these functions in the new RDLC report layout. If you want to modify the report to include this functionality, then you may need to add these functions.
Before you begin this procedure, you must create a layout suggestion for the report. For more information, see How to: Create a Layout Suggestion.
To add BlankNumbers and BlankZero functions
-
In the Classic client, on the Tools menu, click Object Designer.
-
In Object Designer, click Report, select a report in the standard application that contains the BlankNumbers and BlankZero functions, and then click Design. For example, report 206, Sales - Invoice, contains the BlankNumbers and BlankZero functions.
-
On the View menu, click Layout.
-
In Visual Studio, in the Report.rdlc file, click the Report menu, and then click Report Properties.
-
In the Report Properties window, select the Code tab.
-
Copy the code on the Code tab for the following functions:
-
BlankZero
-
BlankPos
-
BlankNeg
-
BlankZeroAndPos
-
BlankNegAndZero
-
-
In Object Designer, select the report to which you want to add the functions, and then click Design.
-
On the View menu, click Layout.
-
In Visual Studio, in the Report.rdlc file for the report to which you want to add the functions, click the Report menu, and then click Report Properties.
-
In the Report Properties window, select the Code tab.
-
Paste the functions into the Custom code text box, and then click OK.
-
Save and compile the report. For more information, see How to: Integrate Classic Client Report Designer and Visual Studio Report Designer.
Example
The following code shows the BlankZero, BlankPos, BlankNeg, BlankZeroAndPos and BlankNegAndZero functions in an RDLC report layout.
Visual Basic | Copy Code |
---|---|
Public Function BlankZero(ByVal Value As Decimal) If Value = 0 Then Return "" End If Return Value End Function Public Function BlankPos(ByVal Value As Decimal) If Value > 0 Then Return "" End If Return Value End Function Public Function BlankZeroAndPos(ByVal Value As Decimal) If Value >= 0 Then Return "" End If Return Value End Function Public Function BlankNeg(ByVal Value As Decimal) If Value < 0 Then Return "" End If Return Value End Function Public Function BlankNegAndZero(ByVal Value As Decimal) If Value <= 0 Then Return "" End If Return Value End Function |