In some reports, you may want to format rows as bold based on the value of a field in the row. For example, in the standard application, the Classic client report 1, Chart of Accounts, rows whose account type is Posting are bold, while rows whose account type is anything other than Posting are not bold.

In the Classic client layout of a report, to specify that some rows are bold, you can create two sections, each with the same fields for the rows of the table. In one section, the rows are bold, and in the other section, the rows are not bold. Then, you can create an OnPreSection section trigger on each section that has a conditional statement. The section trigger for the section in which the rows are bold only calls the SHOWOUTPUT function if the account type is Posting. The section trigger for the section in which the rows are not bold only calls the SHOWOUTPUT function if the account type is not Posting.

In the client report definition (RDLC) layout of a report, section triggers are not supported so you must redesign how you specify that some rows are bold.

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 conditionally change rows to bold font

  1. Add a hidden field to the body section of the Classic report layout. The hidden field should contain the field on which you will determine whether the row is bold. For example, in the Chart of Accounts report, the hidden field contains the account type field. For more information, see How to: Add and Identify Hidden Fields.

  2. In Object Designer, click Report, select the report that you are modifying, and then click Design. In the Classic client, click the View menu, and then click Layout.

  3. In Microsoft Visual Studio, in the Report.rdlc file, select the hidden field that you created in step 1.

  4. In the View menu, click Properties Window.

  5. In the Properties window, under the Visibility field, set Hidden to True.

  6. In the Report.rdlc file, select the data row that you want to display as bold.

  7. In the Properties window, expand the Font field. In the FontWeight field, select <Expression…> from the drop-down list.

  8. In the Edit Expression window, select Fields(DataSet_Result) from the list. Under Field, double-click the field on which you will determine whether the row is bold.

  9. In the text box at the top of the Edit Expression window, use the field that you selected in step 8 to create a conditional statement. For example, the following is the conditional statement for report 1.

    =IIf(Fields!G_L_Account___Account_Type_.Value="1","Normal","Bold")

  10. Save and compile the report. For more information, see How to: Integrate Classic Client Report Designer and Visual Studio Report Designer.

See Also