Information about query items for
SAP BW metadata appears in a different topic .
A query item is the smallest object in the model that can be placed in a report. It represents a single instance of something, such as the date that a product was introduced.
For relational metadata, you can modify the properties of query items by
setting Usage and Regular
Aggregate properties to reflect the intended use of the
query item
formatting query items to control how data appears in a report
identifying a column as a prompt, and controlling how your users
see the prompt information
You can also modify the properties for multiple query items at
the same time .
Because reports can contain different query items from one or more objects in the model, query item properties control many aspects of the final report. When you create a model dimension or model query subject, the query items inherit the properties of the data source query items on which they are based.
The properties for query items or measures include the following.
Query item property | Description |
Name | The name of the query item or measure. |
Description | A description of the query item or measure. |
Last Changed | The date that the query item or measure was last changed. |
Screen Tip | A description that can appear in the published package for your users. |
Expression | Used to create embedded calculations that provide your users with calculated values that they regularly use. This property is for measures only. Note: The Expression property is not used by SAP BW. |
External Name | The name that appears in the data source. |
Is Hidden | Whether to hide or show the query item or measure in the published package. Even when Is Hidden is set to True and the query item or measure is invisible to your users, it is always present in the published package because the query item or measure may be needed by other objects in the model. You do not see the query item or measure in the Package Publish wizard. For example, a calculation may make use of a hidden query item. |
Usage | The intended use for the data represented by the query item. This property is for query items only. |
Format | How information appears in a report. |
Currency | Which currency is used. This property cannot be changed in the Property pane. Use the Format property to change the currency. |
Data Type | The data type that was set in the data source. Because this property is set in the data source, it is read-only in Framework Manager. |
Precision | The total number of digits. Because this property is set in the data source, it is read-only in Framework Manager. |
Scale | How many digits are represented in the scale. For example, you can show numbers in thousands so that 100,000 means 100,000,000. Because this property is set in the data source, it is read-only in Framework Manager. |
Size | The size of the query item or measure. Because this property is set in the data source, it is read-only in Framework Manager. |
Is Nullable | Whether the query item or measure can contain a null value. Because this property is set in the data source, it is read-only in Framework Manager. |
Display Type | How the query item is shown. The column value can appear in the Cognos 8 studios as a picture, as a link, or as a value. The default is value. This property is for query items only. |
MIME Type | The format that the column value uses. For example, if Display Type is set to picture, MIME Type could be jpeg. This property is for query items only. Note: The MIME Type property is not used by SAP BW. |
Prompt Info | Prompt behavior. |
Regular Aggregate | The type of aggregation that is associated with the query item, measure, or calculation in the published package. |
Aggregate Rules | For dimensionally modeled relational metadata, the rules for semi-additive aggregation. For SAP BW metadata, the Aggregate Rules property is read-only. |
Is Unsortable | Whether the values of this query item can be sorted. This property is for query items that contain large objects such as BLOBs. |
You can rename a query item in the Calculation Definition dialog box. Renaming the query item updates references to this query item.
You may be interested in the following related topics:
Information about aggregation of
SAP BW query items appears in a different topic .
You can change how some query items and measures are aggregated in reports. Framework Manager applies aggregate rules when your users create a report that summarizes a query item or measure.
When you import metadata, Framework Manager assigns values to
the Usage and Regular Aggregate properties
for query items and measures depending on the type of object that
the query item or measure is in. The Usage property
identifies the intended use for the data represented by the query
item .
The Regular Aggregate property identifies the
type of aggregation that is applied to the query item or measure
.
Your users can override the values of the Regular Aggregate property.
For semi-additive measures, you can specify additional aggregate
rules by modifying the Aggregate Rules property
.
When modifying the Regular Aggregate property, you can select values that are not available through importing, such as average and maximum. You must understand what the data represents to know which aggregate rule is required. For example, if you aggregate a part number, the only aggregate values that apply are count, count distinct, maximum, and minimum.
Framework Manager uses the following rules to set the Usage and Regular Aggregate properties.
Object | Usage property | Regular Aggregate property |
Query item in a regular dimension | Attribute | Unsupported |
Query item in a measure dimension | Identifier | Count |
Measure in a measure dimension | Fact | Automatic if the measure is a calculation Sum if the measure is not a calculation |
If the measure is semi-additive, use the Aggregate
Rules property to define rules for semi-additive aggregation .
You can change the Usage and Regular Aggregate properties for all types of query subjects. The settings for these properties are based on characteristics such as data type and participation in keys and relationships.
For model query subjects, Framework Manager uses the settings of the underlying query subjects. If the source query subject does not use these properties, the rules for data source and stored procedure query subjects are applied.
For data source or stored procedure query subjects, Framework Manager uses the following rules to set the Usage and Regular Aggregate properties when importing the query subjects.
Object | Usage property | Regular Aggregate property |
Query item is part of a key in a determinant | Identifier | Count |
Query item participates in a relationship | Identifier | Count |
Query item is data type date or time | Identifier | Count |
Query item is data type numeric or time interval | Fact | Automatic if the item is a calculation Sum if the item is not a calculation |
None of the above applies | Attribute | Unsupported |
Framework Manager uses a number of rules for setting the Usage and Regular Aggregate properties for calculations.
The calculated aggregation type is used only for stand-alone calculations. For stand-alone calculations, Framework Manager uses the following rules to interpret the Regular Aggregate property:
Standard aggregation functions (average, count, maximum, minimum, standard deviation, sum, variance) and references to model query subjects are aggregated first. The remaining operations are then applied to the aggregation result.
For example, to divide debt by credit for each row, the SQL looks like this:
Select customer, debt, credit, debt/credit as percent_debt from x
To aggregate for all customers, the SQL looks like this:
Select sum(debt), sum(credit), sum(debt)/sum(credit) as percent_debt from (Select customer, debt, credit from x)
If the query item in the calculation is a fact and the aggregation type for the query item is average, count, maximum, minimum, or sum, the aggregation type of the query item is used.
If the query item in the calculation has no aggregation type set, the aggregation type minimum is applied in the query. It is not possible in SQL to have an aggregation setting of none.
Aggregate functions are interpreted as if they are applied to a value in a single row when these functions are used in the detail context. For example, a Report Studio report has the Auto Group and Summarize property set to false.
Aggregation of a query item is based on the aggregated expression derived from the item definition.
For example, you want to total this stand-alone calculation:
[namespace].[Company].[debt] / [namespace].[Company].[credit]
The calculation is aggregated with this expression:
Total([namespace].[Company].[debt]) / Total([namespace].[Company].[credit])
Scalar aggregates, also known as running, ranking, and moving aggregates, are calculated for report granularity unless the For clause is explicitly specified.
Granularity of aggregate functions is set by grouping for determinants or by keys of corresponding levels in the cube.
For example, Rank([namespace].[Company].[debt] is interpreted as Rank([namespace].[Company].[debt] for Report).
For stand-alone and embedded calculations, Framework Manager uses one of these rules to determine the aggregation type.
Calculation | Aggregation type |
Is based on an expression containing an aggregate function such as average, maximum, minimum, or sum | Calculated |
Has an if-then-else operation and the if condition references fact items | Calculated |
References a calculation using any type except unsupported | Calculated |
Has an aggregation type other than unsupported | Calculated |
Is based on an expression that references a model query subject whose usage is set to fact and whose aggregation type is set to average, count, maximum, minimum, or sum but the query item expression does not use an aggregate function | Summarize See below for the rules for summarize. |
None of these rules apply | Unsupported |
For stand-alone and embedded calculations, Framework Manager uses one of these rules to determine the aggregation type.
Calculation | Aggregation type |
Is a fact containing of only a reference to a query item whose aggregation type is average, count, maximum, minimum, or sum | Uses the aggregation type of the query item |
Numeric or an interval type | Sum |
Time, datetime, or date type | Maximum |
None of these rules apply | Count |
The Usage property identifies the intended use for the data represented by each query item. During importing, the Usage property is set according to the type of data that the query items represent in the data source.
You need to verify that this property is set correctly. For example, if you import a numeric column that participates in a relationship, the Usage property is set to identifier. You can change the property.
For relational query items, the value of the Usage property depends on the type of database object the query item is based on.
Usage property | Database object | Description |
Identifier | key, index, date, datetime | Represents a column that is used to group or summarize the data in a Fact column with which it has a relationship. Also represents an indexed column. Also represents a column that is of the date or time type. |
Fact | numeric, timeinterval | Represents a column that contains numeric data that can be grouped or summarized, such as Product Cost. |
Attribute | string | Represents a column that is neither an Identifier or Fact, such as Description. |
The Regular Aggregate property identifies the type of aggregation for the query item or calculation when you publish it. Your users can either use this default setting to perform calculations on groups of data, or apply a different type of aggregation.
For example, if the Regular Aggregate property value of the Quantity query item is sum, and it is grouped by Product Name in a report, the Quantity column in the report shows the total quantity of each product.
The following aggregation types are supported for relational data sources:
automatic
average
calculated
count
count distinct
maximum
minimum
sum
For measures of dimensionally modeled relational metadata, you can define an aggregate rule for each related dimension. These rules are in addition to the Regular Aggregate property and are used to specify how semi-additive measures are to be aggregated with respect to information from that dimension. A semi-additive measure is one that is to be summed for some dimensions, but should not be summed across some other dimensions. For the dimensions over which the measure is not additive, a different aggregation rule must be specified.
Aggregate rules are applied in this order:
the Regular Aggregate property is applied to dimensions that are included in the query but are not referenced in the Aggregate Rules dialog box
the aggregation that is specified in the Aggregate Rules dialog box is applied to their specified dimensions, in the order that you specified the rules
the report-level aggregation that is specified in the query
For example, inventory is recorded in the data warehouse with opening and closing balances at the month grain. If you need to report on inventory for different periods of time, you apply an aggregate that takes the value from the appropriate time slice within the period. For an opening balance, the value is the last balance of the previous month. For a closing balance, the value is the last balance of the current month. In this example, the inventory measure has a Regular Aggregate property of total and an aggregate rule for the time dimension with a value of last.
You can have only one aggregate rule for each dimension.
Semi-additive measures are not supported for sparse data. Sparse data is multidimensional data in which many of the combinations of dimension values do not have related fact data.
For SAP BW metadata, the Aggregate Rules property value is read-only. The Semi-Aggregate property is used instead.
Click the measure you want to work with.
In the Properties pane, click the ellipsis (...) button in the Aggregate Rules property.
To add a dimension for this measure, click Add and select the dimension.
You can include a shortcut to a dimension if there is a scope relationship between the measure dimension and the regular dimension.
To specify the aggregate operation, click the ellipsis (...) button in the Aggregation Rules box.
The following operations are supported:
sum
minimum
maximum
average
first
last
If you want to change the order of the aggregate rules, use the arrow buttons.
Click OK.
After you set an aggregate rule, the icon for the measure changes.
For relational metadata, the Semi-Aggregate property value is set to unsupported and is read-only.
If the value is set to unsupported in Framework Manager, the semi-aggregate behavior is ignored in the Cognos 8 studios.
The Semi-Aggregate property will not be supported in future releases. Instead, use the Aggregate Rules property for semi-additive measures.
When you use the Determine Usage and Determine Aggregation Rules commands in Framework Manager, you are resetting the values of the Usage and Regular Aggregate back to their default values. This overwrites all changes you have made to these properties.
When generating aggregation values, Framework Manager assigns a value that is based on the Usage property value and the type of object it is.
Usage property value | Regular Aggregate property value |
Identifier | Count |
Attribute | Unsupported |
Fact | Sum |
In the Project Viewer pane, click one or more dimensions or query subjects.
In the Properties pane, click the Properties tab.
Change the Usage property to unknown.
Change the Regular Aggregate property to unsupported.
From the Tools menu, click Determine Usage.
From the Tools menu, click Determine Aggregation Rules.
Information about formatting query
items based on SAP BW metadata appears in a different topic .
You can specify how query item values appear in reports. Use the Format property to choose a format type, such as text, date, and currency. Each format type contains properties that further specify how the data appears.
For example, you can assign the Currency format type to a numeric query item, and then use the No. of Decimal Places property in the Data Format dialog box to specify how many decimal places appear in reports.
Some characters are language-sensitive and appear properly only when your locale supports the applicable font. For example, for Japanese currency symbols to appear correctly, your locale must be set to Japanese.
If Framework Manager does not show the currency you require, you must ensure that you install the appropriate language packs to support the currency symbols. For example, to have the Indian currency symbol (rupee) appear, you must run an operating system or install a language pack that can show this symbol. The Japanese operating system or Japanese language is one that can show the Indian currency symbol.
You can define properties for several query items at the same time. However, if the query items have different format types, all properties that were previously specified are overridden and the default values from the data source are used. If the original format types of the selected query items are the same, all the properties for the selected query items are set identically.
For example, to use the same decimal separator for two query items and to keep the number of decimals different, each query item must be changed individually. If both are selected and changed at the same time, all properties including the number of decimals are set identically for both query items.
In the Project Viewer pane, click the query item you want to format.
In the Properties tab of the Properties pane, click the Format property.
Select the appropriate Format type.
In the Properties box, select or type the appropriate property value.
Click OK.
Information about prompt controls
for SAP BW metadata appears in a different topic .
Prompts help your users quickly find the information they need in a report. Prompts are generally defined in reports. However, you can change the definition of the dimension or query subject in the model so that a prompt appears automatically when your users create filters. This is useful for query items, such as ProductTypeCode, whose values are not shown in a report but are useful for filtering data.
In general, it is better to define type-in prompts in the reports to make use of the additional prompt features. However, your users cannot modify some variables. For these variables, you can use Framework Manager to define type-in prompts.
The syntax for using a prompt as a value is
?<PromptName>?
You can use prompts in
parameter maps
session parameters
stored procedure arguments
expressions, including filters, calculations, and relationships
For example, a stored procedure returns all rows with a specific product number. Instead of using the product number as the argument for the stored procedure, you can use a prompt, such as ?Product_Number?.
For examples of prompts, see Creating Prompts with Query Macros and Example - Use Prompts with a Stored Procedure.
Click the query item.
In the Properties pane, click the Properties tab.
Click the plus sign (+) next to the Prompt Info property.
This is a compound query item property.
Modify the following properties to reflect the behavior you require.
Goal | Property |
Set the type of prompt control that is generated when the report is run. | Prompt Type |
Set the generated prompt as part of a series of generated cascading prompts. | Cascade On Item Reference |
Specify that a prompt defined for one query
item will use a different query item, and its rules, in the prompt. The query item specified in the Display Item Reference property will display a list of values in the prompt. Each value in the list will be associated with a value in the query item specified in the Use Item Reference property. | Display Item Reference |
Specify that a prompt defined for one query
item will use a different query item, and its rules, in the prompt. The query item specified in the Use Item Reference property will be used in the prompt. | Use Item Reference |
Set an alternative query item that is used by any Report Studio or Query Studio filter. | Filter Item Reference |
The Prompt Type property sets the type of prompt control that is generated when the report is run, such as an edit box or a pull-down list. Use this property to have the prompt show one query item but use a different one. For example, the prompt can show Employee Name but use Employee Number.
The default value for this property is Server Determined.
Value | Prompt Control |
Server Determined | The type of prompt control is based on information in the server, such as the data type of the query item. |
Edit Box | A simple text box. If the data type of the column is date or dateTime, this value generates a date or date-time control as well as the text box. |
Select Date | A date control with a calendar interface. |
Select Date/Time | A date-time control with a calendar interface. For SAP BW metadata, this value is not relevant. |
Select Interval | A date-time interval control. For SAP BW metadata, this value is not relevant. |
Select Time | A time control that filters data based on the selected time period. For example, if you define a Select Time prompt for Order Time, the user can use the time control to show all orders placed after 1:00, or all the orders placed between 10:00 and 11:00. If you are referring to a time member, you must use the exact values only. If you are using a range, the end points of the range must correspond to values in the data source. |
Select Value | A drop-down list. |
Select with Search | A list control so that users can search for values. For SAP BW metadata, this value is not relevant. |
Select with Tree | A tree prompt control for prompts that are based on a hierarchy node. |
The Cascade On Item Reference property indicates that the generated prompt is part of a series of generated cascading prompts. The query item that you reference in this property is the parent item in the cascade. The system prompts the user for the cascade item before prompting them for the current query item.
For example, if you want to prompt for Product Line and then Product within the selected line, set the Cascade On Item Reference property of the Product query item to Product Line.
These properties specify that a prompt defined for one query item will use a different query item, and its rules, in the prompt.
The query item specified in the Display Item Reference property will display a list of values in the prompt. Each value in the list will be associated with a value in the query item specified in the Use Item Reference property.
The query item specified in the Use Item Reference property will be used in the prompt.
For example, you want the prompt to display Country Name while using Country Code to retrieve data. Set the Display Item Reference property to Country Name and set the Use Item Reference property to Country Code.
These properties are used only for data driven prompt controls whose Prompt Type property is set to either Select Value or Select with Search.
The Filter Item Reference property identifies an alternative query item that is used by any Report Studio or Query Studio filter. This property is used only when Report Studio or Query Studio generates a filter. This property helps create more efficient queries because it is faster to filter on an indexed numeric column than a non-indexed string column.
For example, a report author wants to create a filter for the Country query item. You set the Filter Item Reference property to use Country Code for any filter that uses the Country query item.
Another example is a report author wants to create a filter for the Country Code query item that appears in the Orders table. You want that filter to use the Country Code in the Country table because there are fewer rows to read in the Country table.
When you test a model object that references a prompt, Framework Manager asks you to enter the prompt value. Framework Manager uses this value for either the duration of the session, or until you clear the prompt value.
You can change the session value of prompt values through the Options dialog box. This dialog box is available when you modify a dimension or query subject, or define a calculation, filter, query set, or complex relationship. You can change the prompt value at the time that you are testing the expression that references that value.
If you select the Always prompt for values when testing check box in the Prompt dialog box, Framework Manager prompts you for a value every time you test the object. When updating the object or performing a count, Framework Manager uses the existing prompt value, if one exists.
A prompt on a query item in a model query subject is associated only with that query item. A prompt on a query item in a data source query subject is associated with the entire query subject and therefore, the prompt appears when you test any query item in the query subject.
You can convert a query item in a measure dimension back into a measure.
You can also convert a measure to a query item .
Double-click the measure dimension that contains the query item.
Click the Measure Dimension tab.
Right-click the query item and click Convert to Measure.
Click OK.