Вы находитесь на странице: 1из 5

Framework Manager Workshop Two

Query Item Properties

1 Workshop Goals
In this workshop, we will look at some query item properties.
This workshop is a script that reads from top to bottom. Each step depends on you having
followed the instructions for the previous steps correctly.

2 Facts and Aggregation


Start Framework Manager and open the GO_Application model.
Setting the query item usage to fact instructs ReportNet that this item is a measure or
detail that is to be aggregated.
Lets ensure the usage of the items in our model make sense. Examine the query items in
all of your query subjects and set them as shown below. As the contents of the Database
view folder are not intended for use by end-users, we will focus our attention on the other
folders. Set the usage on the items listed below to fact and the regular aggregation rule to
sum. For all other items, set the usage to identifier.
\Order Information
\Orders
\ORDER_NUMBER

\QUANTITY
\UNIT_COST
\UNIT_PRICE
\UNIT_SALE_PRICE
\GROSS_PROFIT
\ACTUAL_REVENUE
\PLANNED_REVENUE
\PRODUCT_COST
\MARGIN
\Returns
\RETURN_DATE
\RETURN_DESCRIPTION_EN
\RETURN_QUANTITY
\Product Information
\Products
\PRODUCT_NUMBER

\PRODUCTION_COST
\MARGIN
\Forecasts
\YEAR
\MONTH
\EXPECTED_VOLUME
\Additional

Identifier
Fact, Sum
Fact, SumAverage
Fact, AverageSum
Fact, AverageSum
Fact, Sum
Fact, Sum
Fact, Sum
Fact, Sum
Fact, Sum

Fact, Sum
Identifier
Fact, Sum
Fact, Sum

Fact, Sum


\Sales Rep Information

3 Data Formatting
Format columns in your project (Dates, Percentages, and Currency)
Check formatting options for non-FACT query items.

4 Test Drive
Publish your model to ReportNet.

4.1 Facts (1)


Open Query Studio with the model you just published.
Open the Returns folder and add the column Return Quantity to your report.
Explain the results1.
Add Reason Description to the report.
Explain the results2.
Close Query Studio.
Return to Framework Manager.

4.2 Facts (2)


Change the Usage property of Return Quantity to Identifier.
Re-publish your model.
Open Query Studio with the model you just re-published.
Open the Returns folder and add the column Return Quantity to your report.
Explain the results3.

4.3 Facts (3)


Return to Framework Manager.
Change the Usage property of Return Quantity back to Fact.
1

Return Quantity is a fact and therefore has been aggregated (summed)


Return Description (non-fact) has been grouped and Return Quantity (fact) has been aggregated.
3
Return Quantity is not a fact and therefore has not been aggregated.
2

Change the regular aggregation rule to Maximum.


Re-publish your model.
Open Query Studio with the model you just re-published.
Open the Returns folder and add the column Return Quantity to your report.
Explain the results4.
Add Reason Description to the report.
Explain the results5.
Click on the column title of Return Quantity to select the column.
In the menu, select Edit Data and then

Click Advanced.
Change the Summary For Cell Values to Total.
Click OK.
We now see the totals instead of maximums.

5 Filters
5.1 Data Source Query Subject SQL Filters
You can code a filter directly into the SQL in your data source query subject.
These filters are always applied when the query subject is used in a query regardless of
the user. These filters are integral to the semantics (meaning) of SQL query and are
therefore always applied.
Select *
from [GO Sales].[PRODUCT_LINE][Model].[PRODUCT_LINE].

[PRODUCT_LINE_CODE] = 1
where PRODUCT_LINE_CODE= 1[Model].[PRODUCT_LINE].

[PRODUCT_LINE_CODE] = 1

4
5

You see the Maximum value of Return Quantity.


You see the Maximum value of Return Quantity for each Return Description.

5.2 Model Filters


Model filters are created as independent objects for use in the model or in Framework
Manager, Report Studio or Query Studio.
They provide a way to package up complex filters for easy use or even simple filters for
use consistently throughout the model or reports.
For example, users have requested the ability to filter on different product lines quickly in
Query Studio. Lets add filters for each product line.
Right click on Model namespace and select <Create><Filter>.
Name: Camping Equipment
Expression: [GO Sales].[PRODUCT_LINE].[PRODUCT_LINE_CODE] = 1[Model].
[PRODUCT_LINE].[PRODUCT_LINE_CODE] = 1
Note: We are filtering on the product line code because it is language neutral. In a
multilingual environment, you would want to translate the filter name and description.
Create 2 more filters as so:
1. Name: Mountaineering Equipment.
Expression: [Model] [GO Sales].[PRODUCT_LINE].[PRODUCT_LINE_CODE] = 2
2. Name: Personal Accessories
Expression: [Model][GO Sales].[PRODUCT_LINE].[PRODUCT_LINE_CODE] = 3
Lets organize these filters a bit better.
Select all filters you just created.
Right click and select New Parent Folder.
Rename this folder Product Line Filters.
Move this folder to the Product Information folder under the GO Application
namespace.
<Save> the model.
We will publish the package and in a later step.

5.3 Query Subject Filters


Note: Due to a bug in IB 47.10, this workshop cannot be done.
You can add filters to data source and model query subjects. These filters are applied,
based on the usage, when the query subject is used in a query regardless of the user.

If you wish to use an existing model filter, you simply drag and drop the filter from the
metadata tree into the filter area of the query subject properties dialog and set the usage
as required.
For example, we want to stop our users from accessing orders from before 01 Jan 2006.
We will do this by adding a filter to the ORDERS model query subject.
Edit the definition of the \Order information\ORDERS query subject. Click the Insert
Embedded Filter button:

Name your filter: New Orders.


Expression: [GO_Application].[Orders].[ORDER_DATE] >=2006-01-01
Set the filter Usage to Always.
<Test> the query subject.
<OK>
<Save> the model.
Now publish the package and test the filters by creating a report which includes query
items on which filters are created as above.
Of course, you could also have added this filter to the underlying data source query
subject.

Вам также может понравиться