Professional Documents
Culture Documents
OutputInput Contexts in Formulas For WebIntelligence and BusinessObjects
OutputInput Contexts in Formulas For WebIntelligence and BusinessObjects
Overview
The ability to define complex formulas in either WebIntelligence or
BusinessObjects reports is one of the very powerful features of these products.
This document provides additional explanation on how to do this, including
many examples.
This document should be read by advanced report creators who have already
mastered the basics of report writing.
Contents
INTRODUCTION ............................................................................................ 3
WHAT ARE CALCULATION CONTEXTS ............................................................ 3
HOW TO CHECK RESULTS ............................................................................ 3
The Input Context and the Measure.............................................................4
Filters................................................................................................................. 4
Simplification of the Output context.................................................................. 4
Output context ................................................................................................... 4
Application of the Aggregation function ........................................................... 5
Report this variable in your report ..................................................................... 6
#MULTIVALUE ............................................................................................ 6
CONTEXT OPERATORS (IN, FOREACH, FORALL)........................................... 6
EXTENDED SYNTAX KEYWORDS.................................................................... 7
In Report ......................................................................................................7
In Section .....................................................................................................7
In Block........................................................................................................8
In Break .......................................................................................................8
In Body.........................................................................................................9
DEFAULT CALCULATION CONTEXTS .............................................................. 9
Vertical and Horizontal tables.....................................................................9
Cross Tables ..............................................................................................10
Section........................................................................................................11
Break..........................................................................................................12
MEASURE WITHOUT EXPLICIT AGGREGATION FUNCTION .............................. 13
=<REVENUE> IN (<COUNTRY>) ................................................................. 13
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 1
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 2
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
Introduction
Before you can define a specific calculation context, you must first understand
how calculation contexts work.
• Dimensions - Types of data about your business that can have measures
associated with them (for example: products, years, and states)
• Measures - You can calculate them in relation to dimensions (for example:
<Sales revenue> and <Number of sales>). For example, a report could show
<Sales revenue> (measure) by <Year> (dimension).
The important thing to remember about measures is that they are semantically
dynamic. This means that the figures returned by a measure depend on the
dimensions with which it is associated; in other words, on the context in which
it is placed.
You can see default contexts by creating a block containing <Year> and <Sales
Revenue> objects. In this case, the <Sales Revenue> object returns the revenue
by year, because the revenue is evaluated in the context of the <Year>
dimension. If you then add the <Quarter> dimension to the block, then the
figures in the <Sales Revenue> column change because the default context is
now <Year> and <Quarter>. From this you can see that when you place a
measure or formula in a block, the default calculation context that
WebIntelligence applies includes all the dimensions in the block.
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 3
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
• Aggregate_function: Max
• Measure_Object: <Revenue>
• Input_Context: (<Country>, <Year>)
• Output_Context: (<Country >, <Resort>)
Filters
A global filter or report filter should be applied.
If your formula is in a block, then you should also apply block filters, except if
you use “In Section” in your input context definition.
Output context
On the previous block, we will create a break, based on the output context
dimensions.
If the output context is In Report or with no dimension, then breaks are not
necessary.
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 4
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
Only one value is returned for each group of dimensions; in our case, one
Max(Revenue) value by <Country>.
If the output context is In Report or with no dimension, then you obtain only one
value in the table footer. The value is: 856,560.00.
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 5
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
Max(<Revenue> In
Country Resort Revenue (<Country> ,<Year>) ) In
(<Country>, <Resort>)
France French Riviera 835,420.00 295,940.00
US Bahamas Beach 971,444.00 856,560.00
US Hawaiian Club 1,479,660.00 856,560.00
#MultiValue
Sometimes, instead of getting the correct value in a formula, a #MultiValue
result is returned. This can happen if the application cannot calculate the
formula for a corresponding group of values.
In the previous example, if you would put the formula in the table header, then
you obtain #MultiValue:
This happens because there are two possible values to calculate Max(Revenue)
for: one for US and one for France. The system does not know which one to use.
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 6
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
is equivalent to:
In (<Country>,<Resort>,<Year>) ForAll (<Country>) In (<Resort>,<Year>)
In (<Country>,<Resort>,<Year>) ForEach (<Quarter>) In (<Country>,<Resort>,<Year>, <Quarter>)
In (<Country>,<Resort>,<Year>) ForAll (<Country>, In (<Resort>,<Year>)
<Service>)
In (<Country>,<Resort>,<Year>) ForEach In (<Country>,<Resort>,<Year>, <Quarter>)
(<Country>,<Quarter>)
There are five extended syntax keywords: Report, Section, Break, Block, and
Body
In Report
“In Report” means “All data in the report”.
<Revenue> In Report
This means that we evaluate the measure without dimension. We create a report
with only a cell containing “=<Revenue>”.
is equivalent to:
In Section
We work with the value of a Section. The equivalent is:
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 7
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
is equivalent to:
In Block
We work with the value of a Block. The equivalent is:
is equivalent to:
Equals:
In (<Year>)
In Break
You use it inside a break and the equivalent is:
is equivalent to:
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 8
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
In Body
“In Body” is the default input context.
A block (body, header, or footer) Dimensions in the block (In (All Block Dimensions) )
A block break (header or footer) Dimensions in the block (In (All Block Dimensions) )
A section (header, footer, or outside a block) Dimensions in the section (In Section ?????)
Outside any blocks or sections Section Dimensions in the report (All Sections Dimension)
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 9
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
Cross Tables
We study a cross table (Columns: Year, Quarter, Rows: Resort, Body: Revenue)
in a <Country> section.
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 10
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
Section
A section may have: Header, Footer, and Body. We will study a free cell
Max(Revenue) with the <Country> and <Year> sections:
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 11
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
Break
We study a table (Resort, Year, Quarter, Revenue, Max(Revenue) ) with two
breaks on Year then Quarter and a <Country> section.
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 12
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
The dimensions used to generate the The dimensions used to generate the body of the
body of the block block
(All block dimensions + section (All block dimensions + section dimensions)
dimensions)
E.g.: In (<Resort>, <Year>, <Quarter>, <Country>)
E.g.: In (<Resort>, <Year>, <Quarter>,
<Country>)
A measure may have a default aggregation function. For a measure that comes
from a data provider, the aggregation function is set in the universe as a property
of the measure object. The different aggregation functions are: Sum, Max, Min,
Average, Count, and None.
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 13
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 14
WebIntelligence version 6 Output/Input Contexts in Formulas for WebIntelligence and
BusinessObjects
www.businessobjects.com
Business Objects owns the following U.S. patents, which may cover products that are offered and sold by Business
Objects: 5,555,403, 6,247,008 B1, 6,578,027 B2, 6,490,593 and 6,289,352. Business Objects, the Business Objects
logo, Crystal Reports, and Crystal Enterprise are trademarks or registered trademarks of Business Objects SA or its
affiliated companies in the United States and other countries. All other names mentioned herein may be trademarks
of their respective owners. Product specifications and program conditions are subject to change without notice.
Copyright © 2004 Business Objects. All rights reserved.
10/1/2004 12:39 PM Copyright © 2004 Business Objects. All rights reserved. Page 15