To use Cognos product documentation, you must enable JavaScript in your browser.

Adding Business Rules

Information about business rules for relational metadata appears in a different topic .

Business rules that were created in SAP BW are imported into Framework Manager. You can add more business rules to your model to refine the retrieved data and to ensure that the right information is available for your users.

Creating business rules and storing them in the model instead of in reports has many advantages. You save time because you and your users do not have to re-create the business rules every time they are needed. The business rules ensure consistency because your users all use the same definitions. For example, Low Margin means the same thing throughout the organization. They are easy to update because you maintain the business rules centrally so that all reports are updated automatically as the rules evolve. For example, if the definition for Low Margin changes, all reports that use the Low Margin calculation are updated automatically. The business rules enhance security. For example, you can use filters to limit the data that your users can see.

You can
      

add calculations so that your users can include calculated data in their reports .

      

create and apply filters so that you can limit the data that a query subject retrieves .

      

add prompts that will automatically appear whenever a dimension or query subject is used in a report; report consumers are then prompted to filter data .

      

use session parameters and parameter maps to dynamically resolve expressions.

      

create a security filter to control the data that is shown to your users when they set up their reports .

Create a Calculation

Information about calculations for relational metadata appears in a different topic .

You can create calculations to provide your users with calculated values that they regularly use. Calculations can use query items, parameters, variables, calculated members, expressions, and expression components, such as functions.

Punctuation characters, such as the question mark (?), must be in 7-bit ASCII character code. If you type a punctuation character from a multi-byte enabled keyboard, ensure that you type the 7-bit ASCII representation of the character. For example, type Alt+063 for the question mark.

Avoid using characters that are used for expression operators in the name of the calculation. Syntax errors may occur when the expression is evaluated. For example, a calculation named Margin * 10 causes errors when used in an expression such as [Margin * 10]< 20.

At query time, Framework Manager returns a null value for any calculation that contains a divisor whose value is zero. Framework Manager cannot detect zero-division errors in functions such as average and mod, because the division operator is not explicit.

You can apply a stand-alone calculation to one or more dimensions or query subjects to provide calculated data to a report, or include it in a package to make it available to your users. By moving a stand-alone calculation or a shortcut to it into a folder, you can better organize the model objects.

Steps
  1. Click the namespace or folder and, from the Actions menu, click Create, Calculation.

  2. In the Name box, type a name for the calculation.

  3. Define the expression.

    Goal

    Action

    Add items

    On the Model tab, click a query item, filter, or calculation and click the arrow.

    Add functions

    On the Functions tab, choose a component and click the arrow.

    Add parameters

    On the Parameters tab, click a parameter and click the arrow.

    Retrieve all data and show a specified number of rows

    Click the options button, select the Restrict the maximum number of rows to be returned check box, and type the required number of rows to be returned.

     

    This setting does not improve performance for retrieving data when testing dimensions and query subjects.

    Override session parameters

    Click the options button, click Set, enter a value in the Override Value field, and click OK.

     

    Override prompt values

    Click the options button, and then click Prompts.

     

    The Model Prompts Manager dialog box appears, which shows all prompts, and their values, that are in the model.

  4. To test the calculation, click the test button .

    You can test only calculations that contain query items. If a calculation contains a function, for example _add_days, the test sample button is not available.

  5. Click OK.

  6. Modify the Data Type property to identify the type of data the calculation returns.

    The Cognos 8 studio uses this information to format the data that the calculation returns.

For information about functions, see Using the Expression Editor.

Create a Filter

Information about filters for relational metadata appears in a different topic .

A filter is an expression that specifies the conditions that rows or instances must meet to be retrieved for the dimension, query subject, calculation, or report to which the filter is applied. A filter returns a boolean value so that you can limit the rows returned by a dimension or query subject.

For example, you can use the in_range function to create a filter that retrieves data for products introduced in a specific time frame. The syntax for this example looks like this:

[gosales_goretailers].[Products].[Introduction
date]
in_range {Feb 14, 1999 : July 14, 2007}

Note: When using a date or time function, you must use a 24-hour clock. Framework Manager does not support "a.m." or "p.m." in expressions. For example, use 20:00 to signify 8 p.m.

You can restrict the data represented by dimensions or query subjects in a project by creating a security filter. The security filter controls the data that your users can see when they set up their reports.

You can also apply governors to restrict the data that the queries in a package retrieve.

Framework Manager supports stand-alone filters and embedded filters.

Steps
  1. Do one of the following:

  2. In the Name box, type a name for the filter.

  3. Define the expression.

    Goal

    Action

    Add query items and filters

    On the Model tab, drag the objects you want to the Expression Definition box.

    Add functions

    On the Functions tab, drag the functions to the Expression Definition box.

    Add parameters

    On the Parameters tab, drag the parameters to the Expression Definition box.

    Retrieve all data and show a specified number of rows

    Click the options button, select the Restrict the maximum number of rows to be returned check box, and type the required number of rows to be returned.

     

    This setting does not improve performance for retrieving data when testing dimensions, query subjects, and query sets.

    Override session parameters

    Click the options button, click Set, enter a value in the Override Value field, and click OK.

     

    Override prompt values

    Click the options button, and then click Prompts.

     

    The Model Prompts Manager dialog box appears, which shows all prompts, and their values, that are in the model.

  4. To test the filter, click the test button .

  5. Click OK.

You may be interested in the following related topics:

You can also apply governors to restrict the data that the queries in a package retrieve .

Apply a Filter

Information about filters for relational metadata appears in a different topic .

To apply a filter, you must modify the dimension, data source query subject, or model query subject. The query subject must either contain the query items that the filter references, or have a relationship path to the query subjects that contain the query items.

You can embed a stand-alone filter in dimensions or query subjects, but if you want a different usage for each embedded filter, you must create different versions of the stand-alone filter. Otherwise, your users could be required to fill in a prompt that you thought was optional if there is any instance where the usage is set to mandatory.

For example, in query subject A, you embed a stand-alone filter and define it as optional. In query subject B, you define it as mandatory. When your users create a report that uses both query subjects, they are required to choose values in both filters, even the one defined as optional. All instances of the filter are considered to be mandatory when used in the same query. The solution is to create different versions of the filter, each with its own name.

Steps
  1. Create a filter.

  2. Select the filter and, from the Actions menu, click Edit Definition.

  3. Click the Filters tab, and drag the filter you created to the Filters box.

  4. Select a usage value for the filter.

    Usage ValueDescription
    Always

    Use this usage value to ensure specified data is filtered out of all reports. For example, your company may have obsolete information that it stores but does not want to report on.

    Always is the default usage value.

    Design Mode Only

    Retrieves a small subset of the data for the sample report. Use this usage value when you do not need to see all the data, for example when testing a query subject.

    Your users may need the design mode filter in Query Studio when they want to focus on designing the layout and format of a report and not retrieve all the data as they work. To access the design mode filter in Query Studio, run the report with limited data.

    Optional

    Specifies that the filter is optional. The user is prompted to filter data and can leave the prompt blank. If the prompt is blank, Framework Manager ignores the filter and retrieves all data for the dimension or query subject.

    The ? ? syntax is required for optional prompts.

    Use this usage value if your users want to control when the filter is applied. For example, you want to see on one country sometimes and see the data for all countries at other times. An optional filter for country looks like this:

    ([GeoNamespace].[Countries].[CountryName] = ?WhichCountry?)

  5. If you want to view the SQL, click the Query Information tab.

  6. Click OK.

Create a Parameter Map

Information about parameter maps for relational metadata appears in a different topic .

Use parameters to create conditional query subjects that allow for substitutions when the report is run. Parameter maps are objects that store key-value pairs. Parameter maps are similar to data source look-up tables. Each parameter map has two columns, one for the key and one for the value that the key represents. You can manually enter the keys and values, import them from a file, or base them on existing query items in the model.

All parameter map keys must be unique so that Framework Manager can consistently retrieve the correct value. Do not place quotation marks around a parameter value. You can use quotation marks in the expression in which you use the parameter.

The value of a parameter can be another parameter. However, you must enclose the entire value in number signs (#). The limit when nesting parameters as values is five levels.

When you use a parameter map as an argument to a function, you must use a percentage sign (%) instead of a dollar sign ($).

We recommend that you assign an alias to a query item that uses a parameter map as part of its name and to add the multilingual names to the object in the Language tab (Properties pane).

Note: If you are using SAP BW metadata, you cannot use a query item to generate the keys and values of a parameter map.

Steps to Manually Create a Parameter Map
  1. Click the Parameter Maps folder and, from the Actions menu, click Create, Parameter Map.

  2. In the Name box, type a name for the new parameter map.

  3. Click Manually enter the parameter keys, and/or import them from a file and click Next.

  4. Do one of the following:

    Note: If you are going to use a parameter in a data source query subject, the value must use English-specific punctuation. This means that you must use a period (.) to represent a decimal and a comma (,) to separate lists of values.

  5. Modify existing parameters as required.

    Goal

    Action

    Assign a default value

    In the Default Value box, type a value.

    If the key is used in an expression that is not mapped, the default value is used.

    Remove a parameter

    Select a row and click Delete.

    Modify a parameter

    Select the row you want to modify, click the Edit button, and type a value.

    Clear all keys and values

    Click Clear Map.

  6. Click Finish.

Default Values and Parameter Maps

The Default Low Value and Default High Value properties may contain expressions that use parameter maps. You can use parameter maps to define a value for a target currency variable based on the user’s locale. For example, you define a parameter map that provides an ISO currency code. The value for the Default Low Value property could be defined as

#$Currency_Map[runLocale}#

This parameter map is used when the SAP BW variable Target Currency is used in a report.

These are the only properties related to SAP BW variables that can use parameter maps.

Create a Session Parameter

Information about session parameters for relational metadata appears in a different topic .

A session parameter is a variable that Framework Manager associates with a session. For example, user ID and preferred language are both session parameters. Because session parameters are key and value pairs, you can think of each session parameter as an entry in a parameter map named Session Parameters. You use a session parameter in the same way that you use a parameter map entry, although the syntax for session parameters is slightly different.

There are two types of session parameters: environment and model.

Environment session parameters are predefined and stored in Content Manager. By default, the following session parameters appear in Framework Manager:

If you log on anonymously, you will see only runLocale and account.defaultName(Anonymous).

If your authentication source supports other parameters and you entered information about them in the authentication source, you see other session parameters, such as account.personalInfo.email.

You can define additional parameters by using model session parameters. Model session parameters are stored in a parameter map named _env. They are set in the project and can be published with a package.

Model session parameters must have their values set within the scope of objects in the Framework Manager model. The scope can include the use of existing environment session parameters, as well as static values.

Each session parameter must have a name and a default value. You can define an override value to test the results that value returns. The override value is valid only when you have the model open, and is not saved when you save the model. If no override value exists, Framework Manager uses the default value when it executes a query that contains a session parameter.

The rules governing the use of parameters include the following:

Steps
  1. From the Project menu, click Session Parameters.

  2. Click New Key and type a session parameter key and value.

  3. Choose how to handle the override value.

  4. Modify existing parameters as required.

    Goal

    Action

    Change the parameter value

    Click the row that contains the value you want to change, click Edit, and type a value.

    Assign a default value

    In the Default Value box, type a value. Framework Manager uses the default value if a key has an invalid value.

    Remove a parameter

    Click a row and click the Delete button. You cannot delete an environment session parameter.

    Clear an override value

    Click a row and click Clear Override.

  5. Click Finish.