In This Section:
Understanding Extraction Commands
Understanding Formatting Commands
Understanding Report Script Syntax
Restricting and Ordering Data Values
All report script examples in this chapter are based on the Sample.Basic database.
Oracle Essbase Technical Reference, for report command syntax and an extensive set of report script examples
You create a report using extraction commands, which specify member combinations for pages, columns, and rows.
Extraction commands determine the selection, orientation, grouping, and ordering of raw data records extracted from the database. These commands are based on either dimension or member names, or keywords, and their names begin with the greater-than symbol (>).
Extraction commands apply to the report from the line on which they occur until the end of the report. If another extraction command occurs on a subsequent line of the report, it overrides the previous command.
You use formatting commands to determine the visual design of the report and to control the display of the data values. Formatted data values are displayed in the report when you run the script, based on the combined extraction and report commands.
Formatting commands enable you to customize the format and appearance of a report and create report-time calculations. Formatting commands are generally enclosed in braces ({ }), although several formatting commands begin with the less-than (<) character.
Formatting commands are either applied globally within the report script or are specific to a member.
To build a report, you enter commands that define the layout, member selection, and format you want in Report Script Editor. The different elements of a script are color-coded to aid readability. You can enable autocompletion to help build scripts interactively as you type. See “About Report Script Editor” in the Oracle Essbase Administration Services Online Help.
When you write a report script, follow these guidelines:
Separate commands with at least one space, tab, or new line for readability. Report processing is unaffected by extra blank lines, spaces, or tabs.
Enter commands in uppercase or lowercase. Commands are not case-sensitive. If the database outline is case-sensitive, the members in the report script must match the outline.
To start report processing, enter the bang (!) report output command or one or more consecutive numeric values. You can place one or more report scripts, each terminated by its own ! command, in the same report file.
You can group multiple format commands within one set of braces. For example, these formats are synonymous:
{UDATA SKIP} {UDATA} {SKIP}
Enclose member names in quotation marks in the following cases:
Names beginning with an ampersand (for example, “&Product”).
Names containing spaces (for example, “Cost of Goods Sold”).
Names containing the word Default (for example, “Default Value”).
Duplicate member names, which must be entered as qualified member names (for example, “[2006].[Qtr1]”)
Names containing one or more numerals at the beginning of the name (for example, “100-Blue”)
Names containing any of the characters listed in Table 90:
If a formatting command is preceded by three or more underscore, equal sign, or hyphen characters, respectively, the Report Extractor assumes that the characters are extraneous underline characters and ignores them. For example, ==={SKIP 1}.
Use // (double slash) to indicate a comment. Everything on the line following a comment is ignored by the Report Writer. Each line of a comment must start with a double slash, so you can include multiline comments.
Exercise caution in abbreviating command names. Many names begin with the same letters, and the results may be unexpected unless you use a completely unambiguous abbreviation.
Reports are two-dimensional views of multidimensional data. You can use page layout commands to incorporate additional dimensions that are defined as nested groups of columns or rows on a page, or additional pages in the report.
The page layout is composed of headings that make up the columns and rows of a page. You define the basic layout of a report using page, row, and column data extraction commands combined with specific member selections.
Each component of page layout has a different formatting command:
<PAGE <COLUMN <ROW
In addition, the <ASYM and <SYM commands override the default method of interpreting the column dimension member lists, and produce either an asymmetric or symmetric report format.
See Formatting Page, Column, and Row Headings.
Enter <PAGE(dimensionName, dimensionName)
where dimensioNname lists dimensions represented on the current page. All data values on the page have the dimensions in the page heading as a common property. Example:
<PAGE (Measures, Market)
where dimensionName equals the name of each dimension to display across the page. For example:
<COLUMN (Year)
where dimensionName equals the name of each dimension to display down the page. For example:
<ROW (Market)
<PAGE (Product, Measures) <COLUMN (Scenario, Year) Actual <ICHILDREN Qtr1 <ROW (Market) <IDESCENDANTS East !
Product Measures Actual Jan Feb Mar Qtr1 ======== ======== ======== ======== New York 512 601 543 1,656 Massachusetts 519 498 515 1,532 Florida 336 361 373 1,070 Connecticut 321 309 290 920 New Hampshire 44 74 84 202 East 1,732 1,843 1,805 5,380
You can create page, column, and row headings with members of attribute dimensions.
Example report script:
<PAGE (Measures,Caffeinated) Profit <COLUMN (Year,Ounces) Apr May "12" <ROW (Market,"Pkg Type") Can <ICHILDREN East !
Profit Caffeinated 12 Scenario Apr May ======== ======== New York Can 276 295 Massachusetts Can 397 434 Florida Can 202 213 Connecticut Can 107 98 New Hampshire Can 27 31 East Can 1,009 1,071
You can perform the following modifications to headings in the report using the commands listed in Table 91:
Table 91. Report Writer Commands: Headings
Essbase reports can contain symmetric or asymmetric column groups. Essbase determines the symmetry of column groups automatically, based on the members you select.
A symmetric report, shown below, is characterized by repeating, identical groups of members.
East West Budget Actual Budget Actual Q1 Q2 Q3 Q1 Q2 Q3 Q1 Q2 Q3 Q1 Q2 Q3
An asymmetric report, shown below, is characterized by groups of nested members that differ by at least one member in the nested group. There can be a difference in the number of members or the names of members.
East West Budget Actual Budget Q1 Q2 Q3 Q1 Q2 Q3 Q1 Q2 Q3
By default, Essbase creates a symmetric report unless you select the same number of members for all column dimensions.
For an example of an asymmetric report, see “Sample 13, Creating Asymmetric Columns,” in the Examples of Report Scripts page of the Oracle Essbase Technical Reference.
The Essbase evaluation of symmetry versus asymmetry takes place before any ordering, restriction on columns, or application of the effects of calculated columns.
You can override the default column grouping that Essbase selects for reports with the <SYM and <ASYM commands. <SYM and <ASYM affect the member selection commands that follow them in a report.
Use the <SYM command when the selection of column members meets the requirements of the rule for asymmetry, but you want to produce a symmetric report. The <SYM command always produces a symmetric report, creating all combinations of each column dimension.
Turn off the symmetric format and restore the rules for asymmetric reports with the <ASYM command.
If you need to change only the column headings rather than the symmetry of the report, the <PYRAMIDHEADERS and <BLOCKHEADERS formatting commands are useful.
Use the <BLOCKHEADERS formatting command to change the pyramid-style headers used in symmetric reports to block-style headers such as those used in asymmetric reports. A symmetric report uses the <PYRAMIDHEADERS mode of column layout by default.
Use the <PYRAMIDHEADERS formatting command to change the block-style headers used in asymmetric reports to pyramid-style headers such as those used in symmetric reports. An asymmetric report uses the <BLOCKHEADERS mode of column layout.
Formatting commands, usually enclosed in braces ({ }), define the format of data and labels in the final report and can be either global or member-specific.
Global commands are executed when they occur in the report script file and stay in effect until the end of the report file or until another global command replaces them.
For example, the {SUPMISSINGROWS} command suppresses all rows in the report script file that contain only missing values.
Member-specific commands are executed as they are encountered in the report script, usually the next member in the report script, and affect only that member. A format attached to a member is executed before that member is processed.
For example, the {SKIP} command skips the specified number of rows between row dimensions in a report script. If you want additional rows to skip lines, you must use the SKIP command again.
You can use several formatting commands to design the look of the final report pages. See:
See the Oracle Essbase Technical Reference for examples.
You can set the following page specifications in the report script using the commands listed in Table 92:
You can set the following types of page breaks in the report script using the commands listed in Table 93:
Table 93. Report Writer Commands: Page Breaks
Column and row formatting commands make up a special type of format setting commands.
Specifications for column formatting commands can precede or follow the columns to which they apply, depending on the desired format.
For example, in the following script, based on the Sample.Basic database, the first {DECIMAL} command is processed after two columns are set up, Actual and Budget. The {DECIMAL} command, however, refers to a column three, which does not yet exist. Essbase responds to this command by dynamically expanding the report to three columns. When the report specification expands to six columns, the {DECIMAL} formatting applies to columns three and six (and all multiples of three).
Essbase performs this pattern extension on the assumption that when another dimension is added, causing repetitions of previous column dimension groups, the formatting should repeat as well. The second {DECIMAL} formatting command is then applied to columns 1 and 4 only, as it occurs after the creation of six columns.
Example report script:
<PAGE (Measures, Market) Texas Sales <COLUMN (Scenario, Year) Actual Budget {DECIMAL 2 3 } Jan Feb Mar {DECIMAL 1 1 4 } <ROW (Product) <DESCENDANTS "100" !
Sales Texas Actual Budget Jan Feb Mar Jan Feb Mar === === === === === === 100-10 452.0 465 467.00 560.0 580 580.00 100-20 190.0 190 193.00 230.0 230 240.00 100-30 #MISSING #MISSING #MISSING #MISSING #MISSING #MISSING
The following scripts demonstrate two approaches to column formatting that produce identical results. In the first script, the first two {DECIMAL} commands are positioned to format every first and third column by distributing the formats when Jan Feb displays after processing the {DECIMAL} command.
Example report script: Format columns by distributing the formats
California Sales <COLUMN (Scenario, Year) Actual Budget Variance {DECIMAL 1 1 } {DECIMAL 2 3 } Jan Feb // {DECIMAL 1 1 4 } These lines are commented; the // {DECIMAL 2 3 6 } Report Extractor ignores them. <ROW (Product) <DESCENDANTS "100" !
The two {DECIMAL} commands are positioned to format the individual columns 1, 3, 4, and 6.
Example report script: Format columns by direct assignment
<PAGE (Measures, Market) California Sales <COLUMN (Scenario, Year) Actual Budget Variance // {DECIMAL 1 1 } These lines are commented; the // {DECIMAL 2 3 } Report Extractor ignores them. Jan Feb {DECIMAL 1 1 4 7 } {DECIMAL 2 3 6 9 } <ROW (Product) <DESCENDANTS "100" !
Resulting report for both scripts:
Sales California Actual Budget Variance Jan Feb Jan Feb Jan Feb ===== ==== ==== ==== ===== ==== 100-10 678.0 645 840.00 800.0 (162) (155.00) 100-20 118.0 122 140.00 150.0 (22) (28.00) 100-30 145.0 132 180.00 160.0 (35) (28.00)
Member names too long to fit into columns are automatically truncated; the tilde character (~) signifies that part of the name is missing. Long member names are common when using aliases.
You can modify columns to display the entire member name using the commands listed in Table 94, Report Writer Commands: Long Column and Row Names:
You can suppress the display of page heading, columns, and rows in a report by using the commands listed in Table 95:
Table 95. Report Writer Commands: Suppressing Page Headings, Columns, and Rows
Column and row calculations let you create additional calculations that are not defined as part of the database outline. For example, you can use column and row calculations to create extra columns or rows in a report, based upon selected data members, and perform calculations on these or existing columns and rows.
For examples of report scripts that contain column and row calculations, see “Sample 14, Calculating Columns” on the “Example of Report Scripts” page of the Oracle Essbase Technical Reference.
The CALCULATE COLUMN command lets you create a report column, perform on-the-fly calculations, and display the calculation results in the newly created column.
Table 96 lists column calculation commands:
Table 96. Report Writer Commands: Column Calculation
CALCULATE COLUMN adds up to 499 ad hoc column calculations to a report. Each new calculated column is appended to the right of the existing columns in the order in which it is created and is given the next available column number. These columns calculate the sum of data across a range of columns or an arithmetic expression composed of simple mathematical operators.
The CALCULATE COLUMN command supports standard mathematical operations.
If you use the same name for multiple columns, Essbase creates only the last column specified in the CALCULATE COLUMN command. Use a leading space with the second name (and two leading spaces with the third name, and so on) to create a unique column name.
Alternately, you can add descriptive text far enough to the right that it is truncated to the column width. You can, for example, use the names Q1 Actual and Q1 Budget to distinguish similar column names without affecting the appearance of the report. Column names are printed with right justification until the column header space is filled. Excess characters are then truncated to the right.
Divide lengthy column name labels into multiple lines. The maximum number of lines across which you can divide a label is equal to the number of column dimensions designated in the report specification. To break a column name, insert a tilde (~) in the name at the point where you want the break. You must also specify at least two members for each column dimension to use the maximum number of lines.
{CALCULATE COLUMN "Year to Date~Actual Total" = 1 : 2} {CALCULATE COLUMN "Year to Date~Budget Total" = 3 : 4}
Sales East Actual Year to Date Budget Year to Date Jan Feb Actual Total Jan Feb Budget Total ===== ====== ============= ====== ====== ============= 400-10 562 560 1,122 580 580 1,702 400-20 219 243 462 230 260 722 400-30 432 469 901 440 490 1,391
As a rule, in symmetric reports, if a calculated column name has fewer levels than the number of column dimensions, the previous member (to the left) of each of the column dimensions, above the top level supplied in the calculated column name, is attributed to the calculated column. If normal PYRAMIDHEADERS mode is in use, the centering of those higher-level column members shifts to the right to include the calculated column or columns. Column header members on the same level as calculated column names are not applied to the new calculated column or columns, and their centering does not shift.
If BLOCKHEADERS mode is in use; that is, if every member applying to a column is repeated above that column, the same rules apply, except that instead of shifting column header member centering, they are repeated in the appropriate higher levels of the calculated column name.
Asymmetric reports do not have groups of columns that share a member property. These reports still allow multiple-level column names up to the number of column levels defined, but member properties from preceding columns are not automatically shared and used for those levels that are undefined.
If there are fewer column header dimensions than the number of levels that you want, you can create multiline column labels. In this case, use TEXT, STARTHEADING, ENDHEADING, and other formatting commands to create a custom heading.
If the number of regular (not calculated) columns varies in the report because multiple sections in the report have different numbers of columns, the column numbers used to identify the calculated columns shift accordingly, as illustrated:
If the first section of a report has 12 columns (including row name columns), and three calculated columns are declared, column numbers 0–11 are the regular columns, and columns 12–14 are the calculated columns.
If a second section of the report reduces the number of regular columns to six, then the regular columns are columns 0–5, and the same calculated columns are columns 6–8.
Similarly, if the number of regular columns is increased, the numbering of the calculated columns starts at a higher number.
In the example, CC1, CC2, and CC3 represent the names of three calculated column names. The column numbering for a report with two different sections with varying numbers of regular columns:
internal col # s: 0 1 2 3 4 5 6 7 Jan Feb Mar Apr CC1 CC2 CC3 === === === === === === === Sales 1 3 5 3 22 55 26 Expense 1 2 5 3 23 65 33 same report- new section internal col # s: 0 1 2 3 4 5 Qtr1 YTD CC1 CC2 CC3 === === === === === Sales 2 9 22 57 36 Expense 4 8 56 45 33
If you do not want the calculated columns in the second section, or if you need a different set of column calculation, use the command REMOVECOLCALCS to clear the old ones out. You can then define new column calculations.
This example assumes that all three column calculations had no references to regular columns other than columns 1 and 2. If CC3's calculation were = 1 + 3 + 6, when the second section of the report starts, an error occurs stating that the column calculation referred to a nonexistent column (6).
Row calculations create summary rows in a report. You can use summary rows to calculate the sum of data across a range of rows or to calculate an arithmetic expression composed of simple mathematical operators.
Table 97 lists row calculation commands:
Table 97. Report Writer Commands: Row Calculations
Commands that designate columns must use valid data column numbers, as determined by the original order of the columns.
The CALCULATE ROW command can specify an operation (+, -, *, /, or OFF) as an equation consisting of constants, other calculated rows, and operators. Equations are evaluated at the time of declaration. Member names are not supported in expressions with the CALCULATE ROW command.
If you specify an operator, the operator applies to subsequent output rows and stores the result in the calculated row. Specifying an operator is useful for aggregating a series of rows to obtain a subtotal or total. To reset the operator, use SETROWOP. If the CALCULATE ROW command does not specify either an equation or an operator, the + operator is assumed.
The CALCULATE ROW command supports the standard mathematical operations.
{ CALC ROW "Total Sales" = "Sales..Group1" + "Sales..Group2" }
The example creates “Total Sales” based on two other calculated rows.
Formatting commands customize how data displays in the final report:
Use underlining as a visual aid to break up blocks of information in a report, using the commands listed in Table 98, Report Writer Commands: Underline:
Table 98. Report Writer Commands: Underline
You can suppress data that you do not want to be displayed in the final report by using the SUPPRESS commands listed in Table 99:
Table 99. Report Writer Commands: Suppress Data Formatting
See Suppressing Page, Column, and Row Formatting for descriptions of the SUPPRESS commands used to suppress formats.
Use indenting to provide visual clues to row levels of the script. Table 100, Report Writer Commands: Indent lists the indenting commands:
Table 100. Report Writer Commands: Indent
Titles are user-generated and optional, in contrast to the automatically generated page and column headings and row names, which describe the data on the report page.
Titles repeat at the top of each report page and provide the following information about a report:
To add a title to the report, use the TEXT command, combined with any of the following:
When you run a report, there are often many empty data cells where no data was applicable to the retrieval, or cells where the value is zero.
The report displays the default #MISSING label in the data cell when no data values are found.
To replace the #MISSING label with a text label, at the point in the script where you want to replace the #MISSING label with a text label, type:
{MISSINGTEXT ["text"]}
where text is the text string that to be displayed in the data cells.
You can place the MISSINGTEXT command at any point in the report script; the command applies throughout the script.
You can also suppress #MISSING labels from appearing in the report. See Suppressing Data Formatting for descriptions of SUPPRESS commands used to suppress labels. |
To replace zeros with a text label, at the point in the script where you want to replace zeros with a text label, type:
{ZEROTEXT ["text"]}
where text is the text string to be displayed in the data cells.
Adding blank spaces in a report draws the reader to key information, such as totals. Table 101 lists the commands for adding blank space:
You can change how data values display in the final report by using the commands listed in Table 102:
Table 102. Report Writer Commands: Data Value Display
The data that is displayed in the final report is based upon the members that you select and the order in which you display them. In addition, you can use conditional retrievals to further refine selecting and sorting members.
Member selection commands are extraction commands that select ranges of members based on database outline relationships, such as sibling, generation, and level. Using member selection commands ensures that any changes to the outline are automatically reflected in the report, unless you change the member name on which the member selection command is based. Attribute dimensions can be included in member selection commands.
Table 103 lists the member selection commands:
Table 103. Report Writer Commands: Member Selection
Generation and level name selection commands identify a specific level or generation of members based on either of the following items:
When you use generation and level names, changes to the outline are automatically reflected in the report. You can define your own generation and level names or use the default names provided by Essbase. See Generations and Levels.
Using generation or level names whenever possible makes the report easier to maintain. Because you do not have to specify a member name in the report, you need not change the report if the member name is changed or deleted from the database outline.
Generation and level names are standalone commands. You cannot use them in place of member names in report extraction or formatting commands such as <DESCENDANTS or <CHILDREN. |
To use default level names, at the point in the script where you want to select a member by the default level name, use the format:
Levn,dimensionName
dimensionName is the name of the dimension from which you want to select the members.
For example, Lev1,Year selects all the level 1 members of the Year dimension.
To use default generation names, at the point in the script where you want to select a member by the default generation name, use the format:
Genn,dimensionName
where n is the generation number.
dimensionName is the name of the dimension from which you want to select the members.
For example, Gen2,Year selects all the generation 2 members of the Year dimension.
The following example report script uses the default generation name Gen2,Year to generate a report that includes the members Qtr1, Qtr2, Qtr3, and Qtr4 from the Year dimension:
<PAGE(Product) <COLUMN(Year) <ROW (Measures) {OUTALTNAMES} Cola Gen2,Year Sales Profit !
Cola Market Scenario Qtr1 Qtr2 Qtr3 Qtr4 ======== ======== ======== ======== Sales 14,585 16,048 17,298 14,893 Profit 5,096 5,892 6,583 5,206
You can select duplicate member name outlines by using the commands listed in Table 104:
Table 104. Report Writer Commands: Select Duplicate Members
You create and identify dynamic members in the database outline; they are members calculated only during user retrieval requests, such as generating a report script. The time dimension has a special Dynamic Time Series option. The Dynamic Time Series option has reserved the following generation names that you can define in the outline alias table, as listed in Table 105:
See Applying Predefined Generation Names to Dynamic Time Series Members.
The database header message for the outline identifies the number of dynamic members that are enabled in the current outline. |
To select a Dynamic Time Series member, at the point in the script where you want to select a Dynamic Time Series member, use either:
where memberName is the name of the member in the time dimension.
The <LATEST command, a global command, is applied to the entire report script and is an aggregation based on the lowest level member within the dimension.
where reservedName is the reserved Dynamic Time Series generation name and the memberName is the name of the member in the time dimension.
If you use this syntax to specify a Dynamic Time Series, the time series name is associated only to the member listed in the argument.
When you run the report script, the members are dynamically updated and the information is incorporated into the final report.
Boolean operators enable you to specify precise member combinations within a report—useful when dealing with large outlines. Use the AND, OR, and NOT Boolean operators, combined with extraction commands, to refine member selections within the report script.
To create a Boolean expression using operators, at the point in the script where you want to use linking, enter the format:
<LINK (extractionCommand [operator extractionCommand])
where extractionCommand is the member selection command to retrieve data from, and operator is either the AND or OR operator.
You can use Boolean operators with member selection commands, such as UDA and wildcards. For a list of all valid extraction commands that can be used with the LINK command, see the Oracle Essbase Technical Reference.
The following example selects sweet products from the “100” subtree, plus all products on the same level as “100-10”:
<LINK ((<IDESCENDANTS("100") AND <UDA(Product,Sweet)) OR ONSAMELEVELAS "100"-10")
The following example selects products that are not sweet from the “100” subtree, plus all products on the same level as “100-10”.
<LINK ((<IDESCENDANTS("100") AND NOT <UDA (Product,Sweet)) OR ONSAMELEVELAS "100"-10")
For additional examples of narrowing member selection criteria, see the Oracle Essbase Technical Reference.
Substitution variables act as global placeholders for information that changes regularly; you set the substitution variables on the server through Administration Services, MaxL, or ESSCMD, and assign a value to each variable. You can then change the value anytime, reducing manual changes to a report script. You must have the role of at least Database Manager to set substitution variables.
For example, many reports are dependent on reporting periods; if you generate a report based on the current month, you must manually update the report script every month. With a substitution variable set on the server, such as CurMnth, you can change the assigned value each month to the appropriate time period. Essbase dynamically updates the information when you run the final report.
See Using Substitution Variables for a comprehensive discussion about creating and changing substitution variables in the database outline. For information about the leading & character, see the Oracle Essbase Technical Reference.
You can set substitution variables at the following levels:
To use a substitution variable, at the point in the script where you want to use the variable, use the format:
&variableName
where variableName is the same as the substitution variable set on the server.
<ICHILDREN &CurQtr
<ICHILDREN Qtr1
The substitution variable must be accessible from the application and database against which you are running the report. Also, the variable name can be an alphanumeric combination (for variable name size limit, seeLimits). You cannot use spaces or punctuation in the variable name. |
When you run the report script, Essbase replaces the variable name with the substitution value, and that information is incorporated into the final report.
Using attributes, you can select and report on data based on one or more characteristics of base members. You can group and analyze members of base dimensions according to their attributes. You can also perform crosstab reporting based on multiple attributes. Using the <ATTRIBUTE command, you can select all the base dimension members associated with an attribute. For example, you can query the Sample.Basic database on how many 12-ounce units of grape and orange juice were sold in New York during the first quarter.
To select a member based on a specific attribute, at the point in the script where you want to select members based on a specific attribute, use the format:
<ATTRIBUTE memberName
where memberName is the name of an attribute-dimension member; for example:
<ATTRIBUTE Bottle
returns all products packaged in bottles.
Attribute dimensions have members with the same name. For example, the attribute dimension Ounces and the attribute dimension Age each can have a member named 24. To ensure that a query returns correct results, specify the full attribute-dimension member name. The following format returns all products that are packaged in 24 oz. units:
<ATTRIBUTE Ounces_24
Attribute types can be text, numeric, date, and Boolean. See Understanding Attribute Types.
For a sample report, see “Sample 20: Using Attributes in Member Selection” in the Oracle Essbase Technical Reference.
You can select all base dimension members associated with one or more attributes using the <WITHATTR command. For example, you can display all products associated with a member of the Pkg Type attribute dimension. At the point in the script where you want to select the members, enter the following syntax:
<WITHATTR (attributeDimensionName, "Operator", Value)
The following command returns all base dimension members that are associated with the attribute Small from the Population attribute dimension.
<WITHATTR (Population, "IN", Small)
The following command returns all base dimension members that are associated with the attribute 32 from the Ounces attribute dimension.
<WITHATTR (Ounces, "<", 32)
The <WITHATTR command can be used within the LINK command to refine member selections, as illustrated in the following example: <LINK ((<WITHATTR (Ounces, "<", 32) AND <WITHATTR ("Pkg Type", "=", Can)) |
For a sample report, see “Sample 21: Using the WITHATTR Command in Member Selection” in the Oracle Essbase Technical Reference.
You can extract attributes data for a specific date, for a period before a specific date, or for a period after a specific date using the <TODATE command. For example, you can extract information on all products that were introduced on December 10, 1996, before December 10, 1996, or after December 10, 1996. The <TODATE command must be used within the <WITHATTR command. For example, the following format returns data on all products that were introduced on December 10, 1996.
<WITHATTR ("Intro Date", "=", <TODATE ("mm-dd-yyyy", "12-10-1996")
The following format returns data on all products that were introduced before December 10, 1996.
<WITHATTR ("Intro Date", "<", <TODATE ("mm-dd-yyyy", "12-10-1996")
The following format returns data on all products that were introduced after December 10, 1996.
<WITHATTR ("Intro Date", ">", <TODATE ("mm-dd-yyyy", "12-10-1996")
UDAs enable you to select and report on data based on a common characteristic. UDAs are useful when performing member selections from an outline with an unbalanced hierarchy (in which the members of a dimension do not have identical member levels). You can set UDAs on the server for characteristics such as color, size, gender, flavor, or any other common member characteristics. You must have Database Manager permissions to set UDAs on the server.
UDAs are different from attributes. UDAs are member labels that you create to extract data based on a particular characteristic, but you cannot use UDAs to group data, to perform crosstab reporting, or to retrieve data selectively. For data analysis, UDAs are not as powerful as attributes.
You can use the UDA command with Boolean operators to refine report queries. See Selecting Members by Using Boolean Operators for examples.
Also see Creating UDAs.
In large outlines (for example, with one million or more members), in which many members (for example, half a million members) are assigned to one UDA, querying member sets by UDA can take a long time. To improve the query performance, set the PRELOADUDANAMESPACE configuration setting in essbase.cfg to TRUE. Additional memory might be required for loading the application. See the Oracle Essbase Technical Reference.
To select members based on a UDA, at the point in the script where you want to select members based on the UDA, use the format:
<UDA (dimensionName,"UDAstring")
where dimensionName is the dimension of the member that you select, and UDAstring is the UDA that is set on the server. The following example selects members of the Product dimension with the Sweet attribute.
<UDA (product,"Sweet")
When you run the report script, Essbase incorporates the UDA members into the final report.
You can use wildcards to select members, generation, or level names in a report script. If you use member names, Essbase searches the member and all descendants of that member. If you specify a generation or level name, Essbase searches only members of that generation or level.
Using wildcards reduces the member information needed for a script and simplifies script maintenance.
The following two types of wildcards are supported in Report Writer:
To select members using a trailing wildcard, at the point in the script where you want to select members using a trailing wildcard, use the format:
<MATCH (memberName,"character*")
where memberName is the name of the member that you select, and character is the beginning character in the following member. The following report script:
<MATCH (Year,"J*")
To select members using a pattern-matching wildcard, at the point in the script where you want to select members using a pattern-matching wildcard, use the format:
<MATCH (memberName,"???characters")
where memberName is the name of the member to select, and characters are the characters in the following member. The following report script:
<MATCH (Product,"???-10")
In conjunction with the following items, you can suppress the display of later instances of shared members when you extract data for a report:
Suppress shared members to eliminate unnecessary data duplication within the report.
To suppress shared members, at the point in the script from which you want to suppress a shared member, use:
<SUPSHARE
<SUPSHARE suppresses the display of shared members for the duration of the report script. Use <SUPSHAREOFF to reset the display of shared members.
Aliases make reports easier to read and help the reader focus on the data values rather than the meanings of member names. You can display members in a report by their aliases. For example, you can display page, column, and row names, such as Diet Cola or Caffeine Free Cola, rather than the corresponding member names 100-20 and 100-30.
Qualified member names help identify specific members in duplicate member databases. You can display the qualified member name when duplicate member names are encountered; for example, [State].[New York] and [City].[New York] uniquely identify the member name New York. For information about duplicate member names, see Creating and Working With Duplicate Member Outlines.
Table 106 lists the commands for displaying member names:
Table 106. Report Writer Commands: Member Name Display
<REPALIAS, <REPALIASMBR, <REPMBRALIAS, <REPMBR, and <REPQUALMBR are format commands that can be applied to specific dimensions. They override one another. For example, when Report Writer encounters <REPALIASMBR Product, it displays the alias name in front of the member name. If <REPMBRALIAS Product is found later in the script, Report Writer then displays the member name in front of the alias name. For duplicate member outlines, the <OUTPUTMEMBERKEY command can be combined with any of the other commands in the table. The member identifier, and the member name, alias name, or both, are included in the report output.
Example Displaying a Member Name and Alias
You can display members in a report as a combination of the member name and its alias. Combining the member name and alias enables you to display more descriptive page, column, and row names, such as Diet Cola 100-20 or 100-30 Caffeine Free Cola.
To display member names and aliases, use the <REPALIASMBR command or REPMBRALIAS command in a report script.
This example uses <REPALIASMBR to display the alias name ahead of the member name:
Dark Cream 300-10 Measures Actual Jan Feb Mar Qtr1 ======== ======== ======== ======== Market 800 864 880 2,544 Vanilla Cream 300-20 Measures Actual Jan Feb Mar Qtr1 ======== ======== ======== ======== Market 220 231 239 690 Diet Cream 300-30 Measures Actual Jan Feb Mar Qtr1 ======== ======== ======== ======== Market 897 902 896 2,695 Cream Soda 300 Measures Actual Jan Feb Mar Qtr1 ======== ======== ======== ======== Market 1,917 1,997 2,015 5,929
When you sort the members you include in a report, be aware that sorting commands affect members differently, depending on whether they are referenced by member selection commands or by static member definitions. Report Writer commands sort members by member name or data values.
Member selection commands such as <CHILDREN and <DESCENDANTS, select members in the order specified by the database outline. By default, a report that includes member selection commands displays members in their hierarchical database outline order. You can override this default by specifying a sort order with a sort command.
Because sort commands affect the order of the members selected by the member selection commands, they must precede any member selection commands to which they apply. If you specify a sort command, the sort order is preserved until another sort command overrides it.
Sort commands modify member selection commands, such as <CHILDREN and <DESCENDANTS. Sort commands do not perform final sorting of rows during formatting. Be careful when you place a sort command in the report script that you do not start the sort too soon, and that you override it to turn it off, if necessary, before the next selection command.
Sort commands have no effect on static member definitions.
Table 107 lists the member sort commands:
Table 107. Report Writer Commands: Member Sort
You can perform conditional retrieval and data sorting in reports by using the commands listed in Table 108:
Table 108. Report Writer Commands: Data Value Restriction and Ordering
Configurable variables are used during conditional retrievals. See Changing Buffer Size.
<RESTRICT, <ORDERBY, <TOP, and <BOTTOM can be displayed anywhere in the report script and in any order. When using these commands, place all global script formatting commands before a Page member or a Column member, or before a <PAGE command or <COLUMN command that expands into Page or Column members (for example, IDESCENDANTS, or ICHILDREN).
Essbase extracts data and applies restrictions and ordering in the following order:
<TOP, <BOTTOM, and <ORDERBY commands sort the output of a report by its data values. Essbase applies <TOP and <BOTTOM first, followed by <ORDERBY. If the report contains a sort command, such as <SORTMBRNAMES, which sorts members and not data, Essbase applies the sort command first, followed by <TOP and <BOTTOM, and then <ORDERBY. <ORDERBY is the final sort.
The arguments of the <RESTRICT command let you specify qualifications for selecting rows. Essbase includes only qualified rows in the resulting report output.
<RESTRICT works only on the range of rows that you specify in a row member selection.
Essbase processes the restrictions from left to right, and does not allow grouping with parentheses in the list of arguments.
For example, the following example is not a valid syntax:
RESTRICT (... (@DATACOL(1) > 300 AND @DATACOL(2) < 600)...)
Use only one <RESTRICT per report, as terminated by the ! command. If a report script contains multiple reports, each <RESTRICT overwrites the one in the previous report. For example:
RESTRICT (@DATACOL(1) > @DATACOL(2) AND 800 < @DATACOL(3) OR @DATACOL(4) <> #MISSING)
This <RESTRICT command is equivalent in operation to the following syntax:
RESTRICT (((@DATACOL(1) > @DATACOL(2)) AND (800<@DATACOL(3))) OR (@DATACOL(4) <> #MISSING))
The <ORDERBY command orders the output rows according to the data values in the specified columns. Using an optional direction argument to the ORDERBY command, you can specify either an ascending order using the ASC flag, or descending order using the DESC flag. You can specify different sorting directions in different columns of the same report. If no direction argument is used, ascending (ASC) is the default order.
To determine the set of rows to be ordered, specify the row grouping dimension in the command. The default row grouping is the innermost row dimension.
Only one <ORDERBY is allowed per report, as terminated by the ! command. If a report script contains multiple reports, each <ORDERBY overwrites the one in the previous report.
Avoid using row formatting commands when you are using <ORDERBY in a report. Formatting commands scheduled for a given point in the report may show up unexpectedly because <ORDERBY shifted the row that contained the member with formatting.
In general, avoid using row formatting commands, and place overall script formatting before column members or commands that expand the column members (such as “ICHILDREN column dimension, <column ..., column member”).
The <TOP and <BOTTOM commands specify the qualified number of rows with the highest or lowest column values, respectively, within a row group to be returned in a report. If the row group member is not specified, the innermost row group dimension is the default row group.
You can use <TOP and <BOTTOM together in the same report, but only one <TOP and one <BOTTOM is allowed per report. In this case, the two commands should have the same data column as their argument in order to prevent confusion. The result of the <TOP and <BOTTOM command is sorted by the value of the data column specified in the command in descending order.
<TOP and <BOTTOM work only on the range of rows specified in row member selection.
If <TOP or <BOTTOM occurs with <ORDERBY, the ordering column of the <ORDERBY does not have to be the same as the data column of the <TOP or the <BOTTOM. |
If any combination of the <ORDERBY, <TOP, or <BOTTOM commands exist together in a report script, the row group member (<rowGroupMember>) should be the same. This restriction removes any confusion about the sorting and ordering of rows within a row group.
Essbase discards rows that contain #MISSING values in their sorting column from the set of extracted data rows before the applying the TOP or BOTTOM sort. |
For example, this command returns two rows with the highest data values in col2 (Actual, Qtr2) per row group:
1- TOP (2, @DATACOL(2))
When you run this command against the Sample.Basic database, the row grouping is Product, which implies that for Florida, the report returns 100-10 and 100-30 product rows, and for Maine, the report returns 100-10, 100-40 product rows, and so on:
Actual Budget Qtr1 Qtr2 Qtr1 Qtr2 Florida 100-10 570 670 570 650 100-20 235 345 321 432 100-30 655 555 455 865 100-40 342 342 432 234 Maine 100-10 600 800 800 750 100-20 734 334 734 534 100-30 324 321 235 278 100-40 432 342 289 310 New York 100-10 1010 1210 1110 910 100-20 960 760 650 870 100-30 324 550 432 321 100-40 880 980 880 1080 100-50 #MI #MI #MI #MI
This example returns rows with the highest data values in col2 (Actual, Qtr2) per report, because the row grouping is the “market.”
2- TOP("market", 3, @DATACOL(2))
New York 100-10 1010 1210 1110 910 100-40 880 980 880 1080 Maine 100-10 600 800 800 750
This example returns two rows with the lowest data values in col2 (Actual, Qtr2) per row group.
3- BOTTOM ("market", 2, @DATACOL(2))
Maine 100-20 734 334 734 534 100-30 324 321 235 278
When using the <TOP and <BOTTOM commands, be aware that some other commands affect their operation. In particular, Essbase treats the <SUPPMISSING, <SUPZEROS, and <SUPEMPTYROWS options as restrictions and applies them to the extracted rows along with the <RESTRICT command restrictions. Essbase applies these optional restrictions to the data rows before processing the <TOP or <BOTTOM commands, and before applying an <ORDERBY command.
Whenever a formatting command occurs in a report, it is appended to the member that follows it. For example, in this sequence, {UCOLUMNS}, the underline columns command is appended internally to the member that comes next. In Script 1, it is appended to the row member that can be described as “first child of market, assuming Florida.”
SCRIPT 1 SCRIPT 2 .... .... < ROW Market {UCOL} {UCOL } < Florida (row member) <ICHILDREN Market < TOP .... < BOTTOM ....
Script 2, appends {UCOLUMNS} to the row member Florida. Essbase executes {UCOLUMNS} whenever it encounters a row that has row member Florida. If the TOP or BOTTOM command returns a row that does not contain Florida, the formatting commands appended to the rows are never executed.
Therefore, it is a good idea to place all general formatting commands before a <COLUMN command, or a command that expands into column members to guarantee that the formatting is executed. However, do not use formatting commands that work on rows, because these rows may never be picked up by the <TOP or <BOTTOM command. Also avoid using <SAVEROW and <CALCULATE ROW with the <TOP and <BOTTOM commands.
If the database has a currency partition, you can calculate currency conversions in report scripts. Use the <CURRENCY command to set the output currency and currency type. Use the <CURHEADING command to display the currency conversion heading.
For information about creating a currency conversion application, see Building Currency Conversion Applications and Performing Conversions.
You can generate reports using the C, Visual Basic, and C Grid APIs, as listed in Table 108:
Table 109. Report APIs
See the Oracle Essbase API Reference for descriptions and syntax.