Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
BusinessObjects
Appendix B.................................................................................................................................................55
User Objects .......................................................................................................................................55
User Objects .....................................................................................................................................55
Creating a User Object .....................................................................................................................56
Using a User Object..........................................................................................................................59
Removing a User Object...................................................................................................................60
Appendix C Combined Queries ...............................................................................................................61
Combined Queries............................................................................................................................61
Restrictions .......................................................................................................................................61
Building a Combined Query ..............................................................................................................61
Appendix D Using an XML Data Provider ................................................................................................63
Appendix E ASCII character codes .........................................................................................................67
Chapter 1: 7
Chapter 1
Formulas and Variables
BusinessObjects allows you to create formulas and variables to manipulate the data
after it has been retrieved from the database. You can do projections, change the
format of the data, combine objects, or anything else you can think of.
While user objects operate at the database level through the SQL query, formulas and
variables act on data that has already been retrieved and stored in a data provider.
Formulas and variables are stored in the document where they are created. They are
available to any user of the document and can be refreshed or edited.
Formulas
Formulas are unnamed, which can cause some confusion when there are many formulas
within one report or document. If a formula is changed, the previous version of the
formula is kept and the new version of the formula is added. These unused versions
should be removed to prevent them from slowing the display of the report.
Formula Rules
There is certain syntax that needs to be followed when entering a formula:
Must begin with an equal sign (=). Without an = the formula is displayed as a
constant or text.
Variables included in formulas must be enclosed in a less than (<) and a greater
than sign (>). For example: <Sales revenue>.
Text included in formulas must be enclosed in double-quotes ().
Creating and Entering a Formula
There are three methods to create a formula:
enter a formula directly into the cell
enter a formula into the Formula Bar
use the Formula Editor
In the next example we will use the Formula Editor to enter a formula showing the
running total of Sales Revenue from month to month.
1. Create a standard report using the e-Fashion universe.
2. Add the following objects:
Store name
Month Name
Sales revenue
Chapter 1: 9
The Formula Editor is very similar to user object editor and the variable editor,
except the Formula Editor does not have a Definition tab. A formula remains
unnamed and so has no need for a Definition tab.
9. Click the + to display the Aggregates functions.
10. Double-click the RunningSum function.
Notice that when the RunningSum() is added to the formula, the cursor is placed in
the location for the first argument.
11. Double-click Sales revenue to insert it as the first argument.
The values for the running sum of Sales revenue are added to the blank column.
There is no text in the column heading because the formula has no name associated
with it.
13. Double-click the column heading for the last column.
14. Enter Total.
Resetting the RunningSum
The value for RunningSum needs to be reset to zero for each store. Otherwise value for
January of the second store is added to the sales of the first store.
1. Click on any value in the Total column.
2. In the Formula Bar, change the formula to:
=RunningSum(<Sales revenue>;<Store name>)
This tells the function to reset the value to zero when there is a change in the value
of the Store name object
Variables
A variable is a named formula. They can be used in the same way as variables in the
data provider. Variables are stored in the document .
Variables have some advantages over formulas.
You can use variables in alerters, filters, sorts, breaks, master/detail reports, and in
drill hierarchies.
Since a variable has a unique name, they are easier to work with.
Variables can be used in other formulas. So, a complex formula can be simplified
by using variables to create the formula in pieces.
If the formula for a variable is changed, the original is updated and there is still only
one copy of the variable.
Creating a Variable
Creating a variable is a very similar process to that of creating a formula. The major
difference between the two is that the Variable Editor has a Definition tab, where the
name and variable type are specified.
We will create a variable that concatenates the Address, City, State, and Zip Code
variables into one variable named Location.
1. Edit the data provider and add the following objects:
Address
City
State
Zip Code
Chapter 1: 11
Note: The Char(13) is a carriage return character. This forces the value for City to start
on a second line.
11. Click the Close button to close the Variables dialog box.
12. Drag and drop Location to the right of the Store name.
The report should look like:
14. Click the Yes button to remove the sections for Location.
15. Resize the cell to handle the widest text and two lines.
16. Remove the columns for Address, City, State, and Zip Code.
The report should look like:
Chapter 1: 13
Note: If a student does not have a middle name, it is stored as one space. The Full Name
variable will then have three spaces between the first and last names. This is ok for this
exercise. In the next exercise you will fix the problem with the extra spaces.
Save the document as CQ Exercise 1. This will be used in the next exercise.
Completed Exercise
Chapter 2: 15
Chapter 2
Grouping Values
Sometimes you will want to create new variables by grouping distinct values or a range
of values of existing variables for analysis purposes. There are two methods to
accomplish this within BusinessObjects :
Use the Group option to group values of dimension or detail objects.
Use IfThenElse logic to group values of any objects.
The Group option is easier to use than IfThenElse, but it can be used only with
dimension or detail variables.
Using the Group Option
To see how the Group option works, we will create a column called Region by
grouping states into regions. We can then see the sales revenue for each region.
1. Create a standard report using the e-Fashion universe.
2. Add the following objects:
State
Store name
Sales Revenue
3. Create a condition of Year Equal to 2001
4. Run the query.
5. Select the State column.
6. Click the down arrow for the structure button
7. Click the Insert Column Before
12. Enter the name Region in the Name of the Variable text box.
First, we will group the states that will go into the East region. The states will be
groups in the following categories:
East
Central
West
DC
Colorado
California
Florida
Illinois
Massachusetts
Texas
New York
13. Click the New button to create a new group.
14. Enter East to rename the group.
15. While holding down the CTRL key, click on each state that will be included in the
East region,
16. Click the Add button to add them to the East folder.
Chapter 2: 17
Note: Groups can also be created by selecting values within a column and then clicking
the Group Values
Chapter 2: 19
No
Admission Rescinded
Applicant Rejects Offer
Deny
SI/GPA too low for transfer
Unknown
Wait List
Chapter 3: 21
Chapter 3
Grouping Measure Objects
When possible, its easier to use the Group option discussed above to group values.
But, the group option is not available for measure objects. So, for measure objects its
necessary to create a new variable and use IfThenElse code in its formula.
1. Open the document Grouping.rep.
2. Click any value in the Region column.
3. Select DataEdit Formula.
The formulas for the Region variable is displayed:
= If (<State> InList( "DC" , "Florida" , "Massachussetts" , "New York") ) Then("East")
Else If (<State> InList( "Colorado" , "Illinois" , "Texas") ) Then("Central")
Else If (<State> InList( "California") ) Then("West")
Else <State>
Chapter 3: 23
7. Add the Revenue Group as a new column to the right of Sales revenue.
Your report should now look like:
Chapter 4: 25
Chapter 4
Calculation Contexts
By default, BusinessObjects determines the result of a measure based on the dimensions
in the part of the report in which the measure is inserted. These sets of dimensions are
called calculation contexts.
For example, the tables below all include the Sales revenue object, but the values
displayed are different due to the context of the table.
In
Uses a keyword to define the calculation environment (syntax 2 below), or specifies the
dimensions included in the calculation environment (syntax 1 below).
Syntax 1:
measure In dimensions
Example:
<Sales revenue> In (<State>,<City>)
The revenue for state and city.
Syntax 2:
measure In keyword
Example:
In (<State>)
The revenue for the state.
Calculation Context Keywords
Keywords available for creating formulas are:
Body: Corresponds to dimensions in the current block and dimensions in the
current section. It can be used inside the block for dimensions in the current block,
and outside the block for dimensions in the current section.
Block: Corresponds to dimensions in the current section. It can be used for
dimensions inside the current block.
Report: Corresponds to all dimensions in the document. It can be used for
dimensions anywhere in the report.
CurrentPage: Corresponds to all dimensions in the current page. It can be used
for dimensions inside the current page.
Calculation Context Example
Lets look at an example of calculation contexts.
1. Open the CQ Calculation Context Example document in the Complex folder.
The report should look like:
Chapter 4: 27
The values in the cells are different because of the output context. Next we will
display the context.
Viewing Calculation Contexts
One method to learn more about Calculation Context operators is to view existing
formulas. There are two methods to view formulas:
Using the Formula Bar:
1. Click the cell containing the calculation.
2. Rest the cursor over the Formula Bar.
The extended syntax of the formula appears in a tooltip.
Using the Define As Variable command:
1. Click the cell containing the calculation.
2. Select DataDefine As Variable.
The Define as Variable dialog box will appear.
3. Click Evaluate the formula in its context.
The extended syntax of the formula will appear in the dialog box.
The extended syntax for the three Total Sales cells are, from top down:
=Sum(<Sales revenue> In Body) In Report
=Sum(<Sales revenue> In Body) In <Year>
=Sum(<Sales revenue> In Body) In (<Year>, <State>)
Changing the Calculation Context
1. Copy the contents of the cell with the 1999 California Sales value ($1,704,211).
2. Paste the cell contents into the Percent of 1999 Sales cell.
3. Change the formula for the cell to:
=Sum(<Sales revenue>) In (<Year> ,<State>) / Sum(<Sales revenue>) In
(<Year>)
This divides the sum for the Year/State combination by the sum for the Year. The
report should look like:
4. Copy and paste the formula into the Percent of Total Sales cell directly below.
5. Change the formula to: =<Sales revenue>/Sum(<Sales revenue>) In Report.
This divides the sales for the Year/State by the sales for all state for all years. The
cell should now display 4.68%.
6. Copy and paste the formula into the Percent of Total Sales cell for the year.
This divides the sales for the Year by the sales for all state for all years. The cell
should now display 22.25%.
The finished report should look like:
Chapter 4: 29
Exercises
Create a standard report using the EDW R&A Training universe.
Objects: Last Name, First Name, UIN, ACT Composite Score
Conditions: (Predefined) Springfield
Create a variable that calculates the average ACT score.
Create an Alerter that displays red text for any ACT score less than the average score.
Save the report as CQ Exercise 4
Completed Exercise
Chapter 5: 31
Chapter 5
Subqueries
A subquery is a query within a query. The subquery usually returns a single column of
data which is used in a condition of the main query. The subquery uses the same data
source. Subqueries are created using operand options with a condition. Depending on
the operator used in the condition, you will see one or both operand options:
Create a subquery (ALL)
This operand compares the object with all the values returned by the subquery. For
example: Sales revenue Greater than (all items of the query 1.1).
Create a subquery (ANY)
This operand compares the object with any values returned by the subquery. For
example: Sales revenue Equal to (one item of the query 1.1).
Lets create a report that requires a subquery. We want the stores that sold at least 100
of a particular item in the month of June, 2000. The stores must have also sold at least
1000 of these items for the year. We cant do this with one query because there are
different time periods and different amounts for the number sold.
1. Create the following query with:
City
Store name Quantity sold
2. Create the following conditions:
Year Equal to 2000
Month Equal to 6
SKU desc Equal to E-Watch
Quantity sold Greater than or equal to 100
3. Add a new condition for the Store name object.
4. Select Equal to for the operator.
5. Select Create a subquery (ANY) for the operand.
A new query tab appears, Subquery 1.1.
The subquery needs to produce the list of Store names that sold at least 1000 of
theses watches for the year 2000.
6. Add Store name in the results of the subquery.
7. Add the following conditions:
Year Equal to 2000
SKU desc Equal to E-Watch
Quantity sold Greater than or equal to 1000
To review:
The Subquery 1.1 returns the list of stores that had sales of at least $1 million
in 2000.
The main query returned in the stores that sold at least 100 E-Watches in June
2000 as long as the store was in the list produced by the subquery.
Multiple Data Providers
A data provider contains the results of running a query. This data is then used to create
reports. Building a data provider when you create a new document is a typical way of
using BusinessObjects. You create the document in order to see your data - and to do
that, you have to build a data provider to access data from a data source.
You dont have to create a new document every time you want to see new data in a
report. You can add data providers to existing documents. This feature enables you to
combine data from different sources in the same report.
Chapter 5: 33
Document 1
Report 1
Data
Provider 1
Report 2
Data
Provider 2
Report 3
2. Click below the existing table to place the upper-left corner of the new table.
The New Table Wizard starts.
3. Select Use an existing query to build a new one from the list.
The second table displays the stores that sold at least 100 E-Watches in June, 2000
regardless of the sales for the year. Note there is an additional store, Colorado
Springs.
7. Click the Insert Table
Chapter 5: 35
The bottom table shows the number of e-Watches sold in 2000. As you can see,
Colorado Springs did not sell at least 1000.
Chapter 5: 37
Exercise 5 Subqueries
Note:
Answers to all Reviews/Exercises are provided in Appendix A.
Review
1. A subquery can use a different data source. True or False?
2. A _____________________ is the data returned by running a query.
3. Can there be multiple data providers in the same document?
Exercises
Create a table with all applicants to the Chicago campus that have applied to both the
colleges of Liberal Arts and Sciences and Business Administration. The table
should include the applicants UIN, First Name, and Last Name.
Save the report as CQ Exercise 5
Completed Exercise
Chapter 6: 39
Chapter 6
Using Personal Data Files
Personal data files can be used as a source for a data provider. This enables you to
access data in text files, Excel spreadsheets, dBase files, and XML files. Using
personal data files allows you to use BusinessObjects to create reports from
departmental data, or combine that data with data from the EDW.
Creating a report from a personal data file is a two-stage procedure. First you specify
the personal data file you want to use for the report and then you set the options for the
type of file selected.
File Types Available
The types of files that can be used as a personal data file are:
Microsoft Excel spreadsheet
(*.xls)
DBASE files
(*.dbf)
Text files
(*.txt, *.asc, *.prn, *.csv)
XML files
(*.xml)
Chapter 7: 41
4. Make sure Text Files (*.asc, *.prn, *.txt, *.csv) is selected as the format.
5. Click on the Browse button.
6. Select Recall List.csv from the Complex folder.
7. Check the checkbox for First row contains column names.
8. Click on the View button.
The data file is read and then the Data Manager dialog box is displayed.
9. Click on the SKU variable in the Data Providers panel on the left.
10. Select the Definition tab.
11. Click on the Dimension radio button to change the SKU objects qualification to
dimension.
12. Click on the OK button to close the Data Manager dialog box.
The data from the Recall List.csv file will be displayed in a table.
Chapter 7: 43
3. Select the Access new data in a different way option and click Begin.
4. Click the Next button to use a Universe as the data source.
5. Select the eFashion universe from the list and click the Finish button.
6. Select the following objects in the order shown:
Store name
SKU number
SKU desc
Quantity sold
Chapter 7: 45
The objects for the second data provider will be added to the variables list. When
there are multiple data providers in the document, it is usually better to display the
variable list divided by data provider.
Completed Exercise
Chapter 7: 47
Chapter 7
Combining Data from Different Data Providers
We will now combine data from two data providers in the same table. The source for
the first data provider is a CSV file in the userDocs folder named Recall List.csv. This
file contains the SKU numbers and associated problems of the items being recalled by
the eFashion stores.
Linking Data Providers
Linking data providers enables data from different data providers to be combined in a
table, crosstab, or chart. Dimension objects from one data provider are linked to
dimension objects that contain the same values in a different data provider.
BusinessObjects then finds the corresponding rows from the two data providers Only
dimension objects can be linked.
In this example, the SKU object in the first data provider must be linked to the
corresponding object in the second data provider.
1. Open the Recall.rep document.
2. Delete the table on the left with the data from the csv file.
3. Move the remaining table to the left margin.
4. Click the View Data
5. Click on the + next to each data provider to expand the lists of objects for each.
The SKU object for the first data provider is a measure. We have to change this to a
dimension object so it can be linked to the SKU number object in the second data
provider.
6. Select the SKU object in the first data provider.
7. Click the Definition tab.
8. Change the Qualification for the variable to Dimension.
9. Click on the Link to button.
10. Select the SKU number object from the second data provider.
11. Click the OK button to close the View Data dialog box.
Arrows,
Notice the SKU desc and Store name objects in the second data provider are grayed
out. This means these are incompatible objects. The Problem object is an
unlinked dimension object. SKU desc and Store name are also unlinked dimension
objects. They cannot appear in the table at the same time. To get around this
restriction we will create a detail variable that contains the same data as Problem.
Since we want two unlinked dimension objects from the second data provider and
only one from the first data provider, its easier to create one variable for the
Problem object rather than two variables for SKU desc and Store name.
2. Right-click on the Problem variable in the Report Manager.
3. Select New Variable from the pop-up menu.
4. Enter Problem desc as the name of the new variable.
5. Change the Qualification to Detail.
6. For the Associated Dimension, select SKU.
The detail variable must me associated to a linked dimension object.
Chapter 7: 49
Chapter 7: 51
Completed Exercise
Appendix A: 53
Appendix B: 55
Appendix B
User Objects
It is often necessary for a report developer to add data to a report that is not present in
the universe. BusinessObjects provides three ways to add data to the report:
User Objects
Formulas
Variables
They all make use of the Formula window, and so may seem similar at first. But, there
are some important differences. One major difference is that user objects are associated
with a specific universe, while formulas and variables are associated with a single
document. Also, formulas and variables are stored in the document and are available to
any user refreshing or modifying the document. User objects are stored on the authors
hard drive and are not available to other users. Another difference is that user objects
are written in SQL code, but formulas and variables are written in BusinessObjects
code.
User Objects
A user can create objects that appear to be part of the universe. These objects will
appear in the User Objects class when the universe is displayed in the Query Panel.
The user objects can be used in reports just like any other object in the universe. The
advantage of user objects is that they dont have to be recreated for each new
document.
User objects are personal objects that are not shared with other end-users. They are
stored in a local file in the \Universe folder. The file will have the same name as the
universe.
User Objects Restrictions
Some restrictions placed upon user objects are:
User objects are available only in the universe in which they were created.
User objects are not shared. Reports that include user objects can only be viewed
by other end-users.
This is because user objects are stored locally in a user object definition file. Other
end-users, who do not have the same user object definition file, are not able to access
the user object definitions. If an end-user tries to refresh or edit a query that contains
another users user objects, BusinessObjects removes the objects from the query and
report.
If a user object is meant to be widely shared, then we would recommend contacting
Decision Support to inquire as to the possibility of having that user object added to the
universe.
Both methods display the User Object dialog box to create the formula for the user
object. We will use the Tools menu to create our user object.
We want to project next years revenue based on a 3% increase in sales. We will do
that by adding a user object.
4. Click ToolsUniverses.
The Universes panel will appear, showing all universes to which you have access.
Appendix B: 57
Appendix B: 59
Sales Revenue
Projected Revenue
Appendix C: 61
A second query will appear with a U, for Union, between the tabs. The Results
Objects panel is automatically populated with the Category object from Query 1.
5. Add a condition to this second query of Year Equal to 2000.
6. Right-click the Query 2 tab.
The pop-up menu of combined query types is displayed
7. Select Minus.
8. Run the query.
A table should appear with the two rows, Samples and Skirts, that are in the query
results for 2001 but not in the results for 2000.
Appendix C: 63
button.
Appendix C: 65
Some XML elements do not contain data; they act as a container for other elements.
DATA_RECORD is an example of such an element in this file. It is not meaningful
to include such elements in a report.
9. Uncheck the Audience and Notes fields to not include them.
10. Click the Save button.
The Save XML Filter As dialog box is displayed.
Appendix C: 67
Null char.
Start of Header
Start of Text
End of Text
End of Transmission
Enquiry
Acknowledgment
Bell
Backspace
Horizontal Tab
Line Feed
Vertical Tab
Form Feed
Carriage Return
Shift Out
Shift In
Data Link Escape
Device Control 1
Device Control 2
Device Control 3
Device Control 4
Negative Acknowledg.
Synchronous Idle
End of Trans. Block
Cancel
End of Medium
Substitute
Escape
File Separator
Group Separator
Record Separator
Unit Separator
Space
!
#
$
%
&
(
)
*
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
+
,
.(dot)
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
V
W
X
Y
Z
[
\
]
^
_
`
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
{
|
}
~
delete
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255