Return to IS Home Page.
 

...      ...  ...

 

 

Applying Conditions and Parameters

Ownership

The Director of the Business Support Center is responsible for ensuring that this document is necessary, reflects actual practice, and supports University policy.

Introduction

Creating a query requires planning and an understanding of your business requirements, as well as understanding the policies and procedures that are applicable to the UVA environment.  After you have decided upon the questions you want to ask, you will then begin to create your query.  This also requires decisions along the way.  What business areas to use, what folder or folders contain your information, and what restrictions do you want to apply prior to running the query?  The Noetix help file is a great tool for finding the information for your query.  The wizard guides you through the process, and you can always make changes later.  After you have created your query, you will want to review the results and format the data.  Remember that you can always add items and/or make changes later.  Using the skills that you have learned in the introduction to ODS, we will focus on the advanced tools associated with defining and refining the results.

Section Objectives

At the end of this section, you should be able to:

Applying Conditions

Conditions Overview

A condition is a filter that you place on an item to restrict the number of rows returned from the query.  For example, you may want to see financial information for your Organization that is identified as Org 12345.  To do this, you place a condition on the output to filter all Organizations that do not begin with 12345.

Applying a condition to a table or crosstab after you have created your workbook does not remove the data from the workbook.  It merely filters the data to show the precise data you want to see.  To return the rest of the data to the table or crosstab, you must turn off the condition.

Selecting Conditions

Pre-defined conditions are available at UVA only when accessing pre-defined reports. You can select conditions from the list of available items in the wizard. While stepping through the wizard to build your query, you can choose to include the same conditions or new conditions.

The administrator can predefine two types of conditions: mandatory and optional.

Pre-defined conditions are displayed in the Conditions window and in the Available list in the Workbook Wizard. To see a condition, follow these steps:

1. Select the condition you want to see.

2. Select [Edit] in the Conditions window.  An Edit Condition window appears displaying the condition.

Creating Conditions

You can also create conditions. The conditions that you create are available only in the workbook in which they were created. Thus, you might want to gather worksheets together in the same workbook so that you can use the conditions from all the worksheets in the new workbook.

You can create conditions when you begin to make the selections for your query from the database.  In most instances, if you do not create at least one pre-defined condition while you are creating your query, you may receive vast amounts of information that is not applicable to your question.

Expanding an item and making one or more selections from the list of values creates a condition.  Another way to do this is to create the condition using the Condition Wizard.

Applying a Condition in the Wizard

The slide above shows an example of the Conditions dialog box. A check mark in front of a condition definition indicates that the condition is already applied to the data. You can enable numerous conditions to filter the data in tables and crosstabs.

Conditions dialog box: You can create conditions in the Conditions dialog box, which you open from the Tools menu.

Viewing Conditions for Specific Items: To display either all the conditions defined in a workbook or only those that apply to particular data items, select All Items or the particular data item from the “View Conditions for” drop-down list.

Conflicting Conditions:  If you select two or more conditions that conflict a warning message is displayed.  For example, the two conditions Pa_Period Name=:Pay Period and Pa_Period_Name IN (Mar-02) will conflict if you choose any month in the parameter besides March 2002.  In this example, if you have selected the Month of April, you will receive the conflicting conditions message.  You will need to deselect the conditions that conflict prior to running a successful query.

Creating Simple Conditions

New Condition Dialog Box

Feature

Description

Name

To create your own name for a condition, clear the “Generate name automatically” check box. You can then enter a meaningful name in the Name field.

Description

Advanced conditions may need a more detailed description. Enter a description in the field; it appears in the Conditions dialog box when the condition is selected.

Location

This field shows the workbook name to which the condition is applied.

Select Conditions will be present in the Item drop-down list if any conditions already exist. Select Multiple Values in the Values list will be present if the item has a list of values.

New Condition Dialog Box

Example

Retrieves

Expenditures = 100

Expenditures equal to $100

Expenditures  > 100

Expenditures greater than $100

Organization LIKE 12345

Organization that starts with 12345

Expenditures between 100 and 500

Expenditures between $100 and $500

IN (12345)

Items that are in the 12345 list

NOT LIKE 12345

Organizations that do not start with 12345

Conditional Operators

You can use conditions to reduce the information contained in a particular set of results.  For example, you can display all project numbers, but for a particular result set, you may want to see only those projects for a certain award. 

A conditional operator specifies how an item is to be compared.  The following table gives you examples of the most commonly used operators that are available to you. 

Expression

Meaning

Example

=

Equals

Region = ‘Central”; only the Central Region data is displayed.

<>

Not equal

Region <> ‘Central’; all other region data except Central is displayed.

>

Greater than

Profit SUM > 10000; all Profit Sum items greater than 10000 are displayed.

<

Less than

Profit SUM < 10000; all Profit Sum items less than 10000 are displayed.

<=

Less than or

equal to

Profit SUM <= 10000; all Profit Sum items less than or equal to 10000 are displayed.

>=

Greater than or

equal to

Profit SUM >= 10000; all Profit Sum items greater than or equal to 10000 are displayed.

LIKE

Similar to (using

Wildcard matching

Name LIKE ‘A%’; finds all names beginning with the letter A.  The percent (%) sign matches any number of characters.   A dash symbol (-) matches a single character.

IN

Contains one or

more values

City IN (‘Boston’, ‘Los Angeles’, ‘New York’); finds data that contains at least one of the values.

IS NULL

Contains no data

(not even zero)

Commission IS NULL; displays data only when commission has no value.

IS NOT NULL

Contains some data

(even zero)

Commission IS NOT NULL; displays data when commission has any value.

NOT IN

Is not contained in

one or more values

City NOT IN (‘Boston’, ‘Chicago’); does not display data that contains the words Boston or Chicago.

BETWEEN

A value that lies

between two other

values

Profit BETWEEN 1000 and 2000; displays profits greater than or equal to 1000 or less than or equal to 2000.

NOT BETWEEN

A value that lies

outside of two other

values

Profits NOT BETWEEN 1000 and 2000; displays profits less than 1000 or greater than 2000

NOT LIKE

Not similar to

Name NOT LIKE ‘A%’; finds all names not beginning with A.  The percent (%) sign matches any number of characters.   A dash symbol (-) matches a single character.

!= and ^=

Not equals

Region != ‘Central’; finds all regions except Central.

*Note:  these two expressions have the same meaning because both are supported by SQL programming.  Therefore, if you use a SQL programming statement to create a complex conditional value, Discoverer can recognize it regardless of which expression you use in the program.

Creating a Single Condition

You can create conditions on any item in the results window or in the wizard. To create a condition, follow these steps:

  1. In the Conditions dialog box, select [New].
  2. Select an item from the Item drop-down list.
  3. Select a conditional operator from the Condition drop-down list.
  4. Select a value or option from the Values drop-down list. Options include:
  1. Select [OK] to create the condition.  Select [OK] in the Conditions dialog box to apply the condition to the output.

Advanced Conditions

Creating Complex Conditions

Advanced Conditions

To create multiple conditions for the same condition name, click Advanced in the New Conditions dialog box. The Edit Condition dialog box is displayed. Then follow these steps:

  1. Click the Add button.
  2. Select an item from the Item drop-down list.
  3. Select a conditional operator from the Condition drop-down list.
  4. Select a value or option from the Values drop-down list.
  5. Repeat these steps for each condition.

Grouping Conditions

Condition groups are displayed in the Formula region in the Edit Condition dialog box.  If you want to edit the conditions, you can do so from this dialog box.

The results window displays the results of the grouping conditions.

For instance, you want to find the expenditures for all Educational and Food and Drink expenditure category types. 

In the example above, the condition is:

AND has precedence over OR, while nesting conditions alter the default precedence.  Review the conditions above.  In this example, AND has precedence over OR because it is a nested condition.

Note:            To group, hold down the shift key and select items to group, chen click [And] or [Or] as appropriate.

Changing Logical Operators

By default, the AND operator is used to combine conditions. To toggle between AND and OR, double-click the Group field. To create a condition with multiple logical operators, follow these steps:

  1. Create the conditions as described earlier.
  2. Select the two conditions you want to group with either the [Shift] or [Ctrl] key.
  3. Click the desired logical operator button.

Nested Conditions

A nested condition is a condition that contains other conditions as its components.

Nested conditions are displayed in the Formula region in the Edit Condition dialog box. If you want to edit the conditions, you can do so from this dialog box.

The results window displays the results of the nested condition.

For instance, you want to find out which expenditures for  Educational Supplies and Food & Drink supplies are greater than $500 for your organization. 

In the example above the condition is:

Expenditure Type = Supplies, Educational OR Expenditure Type = Supplies, Food & Drink AND ((expenses are greater than $500) AND (Project Carrying Out Org))

Creating Nested Conditions

1. Create each condition as described previously.

2. Select [Advanced] in the New Condition dialog box.

3. Select a logical operator to group the conditions.

4. Click at the left side of the Item field.  The following list appears:

5. Select the conditions or items you want to nest.  The Conditions box appears.

6. Select the particular condition you want to nest and select [OK].

Parameterized Conditions

Parameters

A parameter is a value within a condition that you specify when you run a query. You use parameters to change conditions without having to change the query. If a query includes a parameter, you are prompted to specify the information you want to see when you run the query. For example, you can create a parameterized query that prompts you for a Pay Period Name and for an Organization Number.

Executing a Parameterized Condition

1. Run the query

2. Enter values or accept the default values.

3. Select [Finish] to execute the query.

4. Select [Sheet / Edit Parameter Value] to enter new values.  You can also select the [Refresh Sheet icon  ] to edit the parameter values.

5. Select [Finish] to execute the query again.

Creating a Parameterized Condition

Select Tools—>Parameters to open the Parameters dialog box. When you create or modify a parameterized condition, you must provide the following information:

Note: To change the conditional operator for a parameter, you must modify it in the Edit Condition dialog box. To disable a parameter, you must disable the condition.

Summary

In this lesson, you should have learned how to: