Defining a Conditional Report Style

In this section:

How to:

Reference:

You can assign a conditional style to a report element. Conditional styling enables you to define conditions that determine when to apply particular fonts, point size, text style, foreground and background color, vertical or horizontal grids, and drill down procedures to your reports data when the report is run.

To apply conditional styling, first you define a global condition. Then, you apply that condition to a report element.


Top of page

Example: Applying Conditional Styling to a Report

The following example highlights employee salaries in excess of $25,000.

You can also include variables that enable you to insert a new conditional value each time the report is run. If the next week you wanted to highlight all salaries that exceed $75,000, you would create a variable condition that prompts you for a number each time the report is run.

Note: If you plan to apply a customized style template, you must do so before you define any conditional styling attributes, or those attributes will be overwritten. For additional information on stylesheets, see the Creating Reports With WebFOCUS Language manual.


Top of page

x
Procedure: How to Access the Edit Condition Dialog Box for a Column

Conditions are created, applied, and styled in the Edit Condition dialog box.

  1. Right-click the column in the Report Painter window and click Options from the context menu.

    The Field Properties dialog box opens.

  2. From the Style tab, click the Edit Conditions button.

    The Condition List dialog box opens.

  3. Click New.

    The Edit Condition dialog box opens.


Top of page

x
Procedure: How to Access the Edit Condition Dialog Box for a Report

Conditions are created, applied, and styled in the Edit Condition dialog box.

  1. Click Styling from the Report Menu.

    The Report Options dialog box opens at the Style tab.

  2. From the Style tab, click the Edit Conditions button.

    The Condition List dialog box opens.

  3. Click New.
  4. The Edit Condition dialog box opens.

Top of page

x
Procedure: How to Access the Edit Condition Dialog Box for an Object Area
  1. Highlight an item (text or field) in an object area.
  2. Right-click the item.
  3. Click Options from the context menu.
  4. From the Style tab, click the Edit Conditions button.

    The Condition List dialog box opens.

  5. Click New.
  6. The Edit Condition dialog box opens.

Top of page

x
Procedure: How to Create a Global Condition for a Report

A global condition applies to any component in a report if you choose to apply a condition. After a condition is defined, you can apply the condition to any object.

Note: You can assign styling after the condition is met. See How to Associate a Style With a Condition in an Object Area, How to Associate a Style With a Condition for a Column, or How to Associate a Style With a Condition for a Report.

Before you begin, review How to Access the Edit Condition Dialog Box for a Report.

Conditions are created, applied, and styled in the Edit Condition dialog box.

  1. Click Styling from the Report Menu. The Report Options dialog box opens at the Style tab.
  2. From the Style tab, click the Edit Conditions button.

    The Condition List dialog box opens.

  3. Click New.

    The Edit Condition dialog box opens.

  4. Type a name for the condition or accept the default.
  5. Select the field for which you want to define a condition from the Field box.
  6. Select a relation from the Relations list.
  7. Specify a value by doing one of the following:
    • Type a literal value in the Value box.

      or

    • Click the Values button to display existing database values and select a value.

      or

    • Click Another Field to display other fields in the report and select a field.
  8. Click OK.

    The condition is now added to the Condition List in the Condition List dialog box, from which it can be applied to one or more columns or to an object area.

    Note: To create another condition, repeat steps 4 to 10.

  9. Click OK again to return to the Style tab on the Report Options dialog box.

    The default condition name (for example, COND0001) appears in the Applying to Condition field box.

    The condition you created appears in the Condition Rule box.

You can apply styling to the condition after it is met. See How to Associate a Style With a Condition in an Object Area, How to Associate a Style With a Condition for a Column, or How to Associate a Style With a Condition for a Report.

For related information about conditional styling of data visualization bar graphs, see Visualizing Trends in Reports.


Top of page

x
Reference: Condition List Dialog Box

The Condition List dialog box has the following fields or options:

Condition

Lists conditions applied or available to be applied to the selected object or report.

New

Enables you to create a condition in the Edit Condition Dialog Box.

Delete

Deletes the selected conditions from the selected object. Select a condition from the Condition list box and press the Delete button.

Edit

Edits the criteria for the selected condition. The Edit Condition dialog box opens. For more information, see the Edit Condition Dialog Box.


Top of page

x
Reference: Edit Condition Dialog Box

The Edit Condition dialog box has the following fields or options:

Condition

Displays the name of the condition being created or edited. To change the default name (for example, COND0001), highlight the text and type a new name.

Field

Displays a list of the columns that appear in the report.

Relation

Displays a list of possible relationships between the selected report column and either a literal value or another field that it will be compared to.

Value

Specifies a literal value or other field to which the selected field is being compared in the When statement. The available choices depend on the option button selected under Compare Type.

Compare Type

Chooses the type of comparison to make to the field selected in the Field section. Select:

Value to compare the selected field to a literal value. Press the Value button for a list of data records.

Another Field to compare the selected field to another field in the data source.



Example: Viewing a Condition in the Condition List Dialog Box

The following image shows the Condition List dialog box displays the condition COND0001: Salary is greater than or equal to $30,000.00:



Example: Creating a Report With Conditional Styling

Tip: For an example of conditional styling with data visualization bar graphs, see Visualizing Trends in Reports.

Suppose that you want to highlight certain values in a report. The following example shows how to create a report that highlights Gotham Grinds vendors who have ordered 300 or more units.

  1. Open the GGORDER data source in Report Painter.
  2. Double-click or drag VENDOR_NAME, PRODUCT_DESCRIPTION, and QUANTITY from the Fields tab of the Object Inspector into Report Painter.
  3. Open the Edit Condition dialog box to create a condition for Ordered Units:
    1. Right-click Ordered Units in the Report Painter window and select Options from the context menu to open the Field Properties dialog box.
    2. From the Style tab, click the Edit Conditions button to open the Condition List dialog box.
    3. Click New to open the Edit Condition dialog box.
  4. Create a condition and name it ordgt300.
    1. Type ordgt300 in the Condition box.
    2. Click QUANTITY from the Field list.
    3. Click Is greater than or equal to from the Relations list.
    4. Click the Values button and select 300 from the Value window.
    5. Click OK to return to the Condition List dialog box with the defined condition displayed.
    6. Click OK to return to the Style tab.
  5. Add a font style to the condition.
    1. Click ordgt300 in the Applying to Condition list box to apply the styling options to this condition.
    2. In the Graphical area of the Style tab, click the Select Font button to open the Font dialog box.
    3. Click Bold from the Font Style list and select the Underline check box.
    4. Click OK to return to the Style tab.
  6. Add a background color.
    1. In the Graphical area of the Style tab, go to the Background Coloring area and click the Single Color option button and then the Select Colors button.
    2. Select the color yellow in the Color dialog box. The styles you have applied appear in the Sample area.
    3. Click OK to return to the Report Painter window.
  7. Run the report by clicking the Run button on the toolbar.

    The report appears in the browser, as shown in the following image.



Example: Creating a Condition With Variable Values

Suppose you want a report that conditionally highlights values. The following example shows how to create a report of the total number of orders for each Gotham Grinds store and highlight those orders placed on a specific day.

  1. Open the GGORDER data source in Report Painter.
  2. Identify your report columns.
    1. Identify your sort columns. Click By on the Report Painter toolbar. Double-click or drag VENDOR_NAME, ORDER_DATE, and STORE_CODE from the Fields tab in the Object Inspector.
    2. Identify your detail column. Move the insertion point after the Store Code column. Click Detail on the Report Painter toolbar. Double-click or drag the QUANTITY from the Fields tab of the Object Inspector.
  3. Add a page heading.
    1. Position the cursor in the page heading by clicking your left mouse button in the heading area and type the following in the heading area:

      Information On Orders Placed On = &date.

    2. Press the Enter key to bring your cursor to the next line.
  4. Open the Edit Condition dialog box to create a condition for Vendor Name, Order Date, Store Code, and Ordered Units.
    1. Choose Styling from the Report menu.
    2. Select Data from the active object drop-down list.
    3. Click Edit Conditions and then click New on the Edit Condition dialog box to create a new condition.
  5. Create a condition and name it rundate.
    1. Type rundate in the Condition box.
    2. Click ORDER_DATE from the Field list.
    3. Select Is equal to from the Relations list.
    4. Type the variable &date in the Value box.
    5. Click OK to return to the Condition List dialog box.
    6. Click OK to return to the Style tab on the Report Options dialog box.
  6. Add a background color.
    1. In the Graphical area of the Style tab, go to the Background Color group box and click the Single Color option button and then the Select Colors button.
    2. Select the color Gray-25% in the Color dialog box.
    3. Click OK to return to Report Painter.
  7. Click Run on the toolbar to run the report. You are prompted for a date.

  8. Type 01/01/96 and press Enter to run the WebFOCUS query, as shown in the following image.


Top of page

x
Associating a Style With a Condition

How to:

The following procedures provide information on how to associate style with a condition.



x
Procedure: How to Associate a Style With a Condition in an Object Area

Before you begin, review How to Access the Edit Condition Dialog Box for a Column.

  1. Select a defined condition from the Applying to Condition box.
  2. Choose one or a combination of the following:
    • Click the Select Font button to specify conditions, such as font, font style and size, color and effects.
    • Click the Background button to select a background color.
    • Click the Select Grid button to select a line style (for PDF output formats only).
    • Click the Drill down tab to embed a procedure. For more information on drill down, see Creating a Drill Down Procedure.
  3. Click OK. The style is associated with the condition and you return to the Report Painter window.


x
Procedure: How to Associate a Style With a Condition for a Column

Before you begin, review How to Access the Edit Condition Dialog Box for a Column.

  1. Select a defined condition from the Applying to Condition dialog box in the Style tab.
  2. In the Graphical area of the Style tab, choose one or a combination of the following:
    • Click the Select Font button to specify conditions, such as font, font style and size, color and effects.
    • Click the Select Grid button to select a line style (for PDF output formats only).
    • Click the Select Borders button to select a line style.
    • In the Background Coloring area, click the Single Color option button to select a background color.
  3. Click OK. The style is associated with the condition and you return to the Report Painter window.


x
Procedure: How to Associate a Style With a Condition for a Report

Before you begin, review How to Access the Edit Condition Dialog Box for a Report.

  1. Select a defined condition from the Applying to Condition dialog box in the Style tab.
  2. In the Graphical area of the Style tab, choose one or a combination of the following:
    • Click the Select Font button to specify conditions, such as font, font style and size, color and effects.
    • Click the Select Borders button to select border styles.
    • Click the Select Grid button to select a line style.
    • Click the Visualize button if you want to select conditional styling criteria for data visualization bar graphs. For more information, see Visualizing Trends in Reports.
    • In the Background Coloring area, click the Single Color option button and then the Select Colors button to select a background color.
  3. Click OK. The style is associated with the condition and you return to the Report Painter window.


x
Procedure: How to Clear Associated Styling for a Column

Before you begin, review How to Access the Edit Condition Dialog Box for a Column.

  1. Select a defined condition from the Applying to Condition dialog box in the Style tab.
  2. Click the Clear Associated Styling button.

Note: If you change your mind and want to keep the conditional styling, click Cancel on the Style tab. The condition will appear in the Applying to Condition dialog box the next time you access Field Properties dialog box.



x
Procedure: How to Clear Associated Styling for a Report

Before you begin, review How to Access the Edit Condition Dialog Box for a Report.

  1. Select a defined condition from the Applying to Condition dialog box in the Style tab.
  2. Click the Clear Associated Styling button.

Note: If you change your mind and want to keep the conditional styling, click Cancel on the Style tab. The condition will appear in the Applying to Condition dialog box the next time you access the Report Options dialog box.


Top of page

x
Editing Conditions

How to:

The following procedures provide information on how to edit conditions.

Before you begin, review How to Access the Edit Condition Dialog Box for a Column or How to Access the Edit Condition Dialog Box for a Report.



x
Procedure: How to Edit a Condition
  1. Select a condition from the Applying to Condition field box on the Style tab of the Report Options dialog box.
  2. Click the Edit Conditions button.

    The Condition List dialog box opens.

  3. Click the Edit button or double-click the selected condition.

    The Edit Condition dialog box opens.

  4. Select a field name from the Fields window.
  5. Select a relation from the Relations list box.
  6. Specify the value by choosing one of the following:
    • Type a literal value in the Value box.

      or

    • Click the Values button to display existing database values and select a value.

      or

    • Click Another Field to display other fields in the report and select a field.
  7. Click OK to return to the Conditional List dialog box.
  8. Click OK again to return to the Style tab in the Report Options dialog box.

Note: After a condition is changed, all objects that the condition is applied to will be affected.



x
Procedure: How to Add a Condition to a Column
  1. Right-click the column in the Report Painter window and click Options from the context menu.

    The Field Properties dialog box opens.

  2. Select a condition from the Applying to Condition field box.
  3. Click the Edit Conditions button.

    The Condition List dialog box opens, displaying conditions for the column or object.

  4. Select a condition from the Condition list box or create a new condition.
  5. Click OK.

    Note:

    • A condition determines the rule for conditional styling, but not the style. Therefore, you must define the style.
    • A plus sign (+) appears next to an applied condition that also has styling associated to it in the Applying to Condition field box.



x
Procedure: How to Add a Condition to a Report
  1. Click Styling from the Report Menu. The Report Options dialog box opens at the Style tab.
  2. Select a condition from the Applying to Condition field box on the Style tab of the Report Options dialog box.
  3. Click the Edit Conditions button.

    The Condition List dialog box opens, displaying conditions for the column or object.

  4. Select a condition from the Condition list.
  5. Click OK.

    Note:

    • A condition determines the rule for conditional styling, but not the style. Therefore, you must define the style.
    • A plus sign (+) appears next to an applied condition that also has styling associated to it in the Applying to Condition field box.



x
Procedure: How to Add a Condition to an Object Area

Before you begin, review How to Access the Edit Condition Dialog Box for a Column.

  1. Select the object area.
  2. Highlight the item you want to style, then right-click and click Grid Options or Cell Options.

    The Properties dialog box opens, displaying conditions for the column or object.

  3. Select a condition from the Condition list or create a new condition.
  4. Click OK.

Note: A condition determines the rule for conditional styling, but not the style. Therefore, you must define the style.



x
Procedure: How to Rearrange the Order of Conditions Applied in a Column
  1. Right-click the column in the Report Painter window and click Options from the context menu.

    The Field Properties dialog box opens.

  2. Select a condition from the Applying to Condition field box on the Style tab of the Report Options dialog box.
  3. Click the Move Condition Up or Move Condition Down button.

Note: Order is significant because conditions are applied in the order listed. For example, if the first and last conditions are both true, the style in the last condition will override the style in the first.



x
Procedure: How to Rearrange the Order of Conditions Applied in a Report
  1. Click Styling from the Report Menu. The Report Options dialog box opens at the Style tab.
  2. Select a condition from the Applying to Condition field box on the Style tab of the Report Options dialog box.
  3. Click the Move Condition Up or Move Condition Down button.

Note: Order is significant because conditions are applied in the order listed. For example, if the first and last conditions are both true, the style in the last condition will override the style in the first.



x
Procedure: How to Rearrange the Order of Conditions Applied in an Object Area

Before you begin, review How to Access the Edit Condition Dialog Box for an Object Area.

  1. Open the Properties dialog box for the selected object area by right-clicking the object area and selecting Grid Options or Cell Options.
  2. Select a condition from the Applying to Condition box, then click the Move Condition Up or Move Condition Down button.

Note: Order is significant because conditions are applied in the order listed. For example, if the first and last conditions are both true, the style in the last condition will override the style in the first.



x
Procedure: How to Delete a Condition From a Column
  1. Right-click the column in the Report Painter window and click Options from the context menu.

    The Field Properties dialog box opens.

  2. Select a condition from the Applying to Condition field box on the Style tab of the Field Properties dialog box.
  3. Click the Edit Conditions button. The Condition List dialog box opens.
  4. Select a condition from the Condition list.
  5. Click Delete. (If the condition is in use and you still want to delete it, click Yes when you are prompted.)
  6. Click OK. You return to the Style tab on the Field Properties dialog box.

Note: These steps remove the condition from the selected object only. It does not delete the condition. The condition is still available to be added to other objects in the report.



x
Procedure: How to Delete a Condition From a Report
  1. Click Styling from the Report Menu. The Report Options dialog box opens at the Style tab.
  2. Select a condition from the Applying to Condition field box on the Style tab of the Field Properties dialog box.
  3. Click the Edit Conditions button. The Condition List dialog box opens.
  4. Select a condition from the Condition list.
  5. Click Delete. (If the condition is in use and you still want to delete it, click Yes when you are prompted.)
  6. Click OK. You return to the Style tab on the Field Properties dialog box.

Note: These steps remove the condition from the selected object only. It does not delete the condition. The condition is still available to be added to other objects in the report.



x
Procedure: How to Remove a Condition From an Object Area

Before you begin, review How to Access the Edit Condition Dialog Box for an Object Area.

  1. Right-click the object area, then open the Edit Conditions dialog box.
  2. Select a condition.
  3. Click the Delete button.
  4. Click OK.

Note: These steps remove the condition from the selected object only. It does not delete the condition. The condition is still available to be added to other objects in the report.



x
Procedure: How to Copy a Condition From One Column to Another

You can copy a condition from one column to another.

  1. Select the column(s) that you want to apply styling to by simultaneously clicking your mouse and pressing the Shift key.
  2. Select the column that contains the styling you want to apply and keep the Shift key pressed as you click it.
  3. Click the Match Conditional Styling option from the Match All Styles drop-down list , and then select the column(s) you want to apply the formatting to.

To copy all formatting characteristics (including font, grid, background color, and conditional styling) from one column to another, click the Match All Styles option.



x
Procedure: How to Conditionally Execute a Drill Down Procedure
  1. Right-click the column in the Report Painter window and click Options from the context menu.

    The Field Properties dialog box opens.

  2. Click the Drill Down tab.
  3. Click the Edit Conditions button.

    The Condition List dialog box opens.

  4. Click New.

    The Edit Condition dialog box opens.

  5. Select a condition from the Condition list box or create a new condition.
  6. Click OK to return to the Drill Down tab.
  7. Click OK to close the Field Properties dialog box and return to Report Painter.

WebFOCUS