Essbase® Analytic Services Database Administrator's Guide | | Update Contents | Previous | Next | Print | ? | |
Information Map | |
Once you understand the basics of creating report scripts, you can create more complex reports. You create a report using extraction commands which specify member combinations for pages, columns, and rows. 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.
This chapter provides information about creating complex report scripts:
For fundamental information about reports and report scripts, see Understanding Report Script Basics.
For report command syntax and an extensive set of report script examples, see the Technical Reference.
Extraction commands perform the following actions:
Formatting commands perform the following actions:
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 in readability. You can enable auto-completion to help build scripts interactively as you type. For more information, see "About Report Script Editor" in Essbase Administration Services Online Help.
When you write a report script, follow these guidelines:
{UDATA SKIP} {UDATA} {SKIP}
===
{SKIP 1}.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:
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.
For information about formatting the page, column, or row headings, see Formatting Page, Column, and Row Headings.
To design the report headings, perform the following tasks:
<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. The following is a valid <PAGE command:
<PAGE (Measures, Market)
<COLUMN (
dimensionname
)
where dimensionname equals the name of each dimension to display across the page. The following is a valid <COLUMN command:
You can add dimension names to create nested column headings.
<ROW (
dimensionname
)
where dimensionname equals the name of each dimension to display down the page. The following is a valid <ROW command:
Note: You can select additional members to associate with the heading commands. If you type a member name as a parameter for the PAGE, COLUMN, or ROW commands, Report Extractor automatically associates the member with the appropriate dimension.
The following report script is based on the Sample Basic database:
<PAGE (Product, Measures) <COLUMN (Scenario, Year) Actual <ICHILDREN Qtr1 <ROW (Market) <IDESCENDANTS East !
This script produces the following report:
You can create page, column, and row headings with members of attribute dimensions. The following report script is based on the Sample Basic database:
<PAGE (Measures,Caffeinated) Profit <COLUMN (Year,Ounces) Apr May "12" <ROW (Market,"Pkg Type") Can <ICHILDREN East !
This script produces the following report:
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:
For descriptions of the SUPPRESS commands used to suppress headings, see Suppressing Page, Column, and Row Formatting.
Analytic Services reports can contain symmetric or asymmetric column groups. Analytic Services 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.
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.
By default, Analytic Services 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 Technical Reference.
The Analytic Services evaluation of symmetry versus asymmetry takes place prior to any ordering, restriction on columns, or application of the effects of calculated columns.
You can override the default column grouping that Analytic Services selects for reports with the <SYM and <ASYM commands. <SYM and <ASYM affect the member selection commands that follow them in a report.
If you only need to change the column headings rather than the symmetry of the report, the <PYRAMIDHEADERS and <BLOCKHEADERS formatting commands are useful.
Formatting commands define the format of data and labels in the final report. These commands are generally enclosed in left and right braces ({ }).
The two types of formatting commands are global and member-specific commands.
For example, the {SUPMISSINGROWS} command suppresses all rows in the report script file that contain only missing values.
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.
There are a number of formatting commands that you can use to design the look of the final report pages.
See the Technical Reference for report formatting examples.
You can set the following page specifications in the report script:
Task |
Report Command |
---|---|
You can set the following types of page breaks in the report script:
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 only two columns are set up, Actual and Budget. The {DECIMAL} command, however, refers to a column three, which does not yet exist. Analytic Services 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).
Analytic Services 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.
<PAGE (Measures, Market) Texas Sales <COLUMN (Scenario, Year) Actual Budget {DECIMAL 2 3 } Jan Feb Mar {DECIMAL 1 1 4 } <ROW (Product) <DESCENDANTS "100" !
This script produces the following report:
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. These examples are based on the Sample Basic database.
//Script One: Format Columns by Distributing the Formats <PAGE (Measures, Market) 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.
// Script Two: 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" !
Both scripts produce the following report:
Note: By default attribute calculation dimension members (for example, SUM, AVG) are displayed as columns. To display them in rows, you must include them in the ROW command.
Member names that are too long to fit into the column are automatically truncated; the tilde character (~) signifies that part of the name is missing. Long member names are common when using aliases in the report.
There are several ways to modify columns to display the entire member name.
Task |
Report Command |
---|---|
Change where the row member column is displayed, and to shift the remaining columns left or right to make room fro the long member names. |
You can suppress the display of page heading, columns, and rows in a report by using SUPPRESS commands.
To repeat the row member names on every line of the report, use the <ROWREPEAT command. Use the <NOROWREPEAT command to prevent row member names from being repeated on each line of the report if the row member name does not change on the next line. NOROWREPEAT is enabled by default.
You can place tabs between columns rather than spaces in report scripts, for example, when you want to export report output into another form.
To replace spaces with tab delimiters, type {TABDELIMIT} anywhere in the report script.
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" in the "Example of Report Scripts" page of the Technical Reference.
The CALCULATE COLUMN command lets you create a new report column, perform on-the-fly calculations, and display the calculation results in the newly created column.
The following table summarizes column calculation commands:
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 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 the standard mathematical operations. For syntax and parameter descriptions, see the Technical Reference.
If you use the same name for more than one column, Analytic Services 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 two or more 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 the tilde character (~) 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.
This example is based on the Sample Basic database.
{CALCULATE COLUMN "Year to Date~Actual Total" = 1 : 2} {CALCULATE COLUMN "Year to Date~Budget Total" = 3 : 4}
The example produces the following report:
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 not defined.
In cases where there are fewer column header dimensions than the number of levels that you want, you can create multi-line column labels. In this case, use TEXT, STARTHEADING, ENDHEADING, and other formatting commands to create a custom heading.
For the syntax and definitions of column calculation commands, see the Technical Reference.
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 in the following examples:
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 looks as follows:
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.
The following table summarizes row calculation commands:
For the syntax and definitions of row calculation commands, see the Technical Reference.
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. For syntax and parameter descriptions, see the Technical Reference.
This example is based on the Sample Basic database.
{ CALC ROW "Total Sales" = "Sales..Group1" + "Sales..Group2" }
The example creates "Total Sales" based on two other calculated rows.
You can use a variety of formatting commands to customize how data displays in the final report.
Use underlining as a visual aid to break up blocks of information in a report.
You can suppress data that you do not want to be displayed in the final report by using SUPPRESS commands.
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.
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:
Note: You can also use the TEXT command at the bottom of the report to provide summary information.
See the Technical Reference for the syntax and definitions of Report Writer commands.
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 add the following to the report script:
At the point in the script where you want to replace the #MISSING label with a text label, type:
{MISSINGTEXT ["text"]}
where text is any text string that you want to display in the data cells.
You can place the MISSINGTEXT command at any point in the report script; the command applies throughout the script.
Note: You can also suppress #MISSING labels from appearing in the report. See Suppressing Data Formatting for descriptions of SUPPRESS commands used to suppress labels, or see the Technical Reference for the syntax and definitions of Report Writer commands.
To replace zeros with a text label add the following to the report script:
At the point in the script where you want to replace zeros with a text label, type
{ZEROTEXT ["text"]}
where text is any text string that you want to display in the data cells.
Note: If a value is equal to #MISSING, any string you try to insert after that value using the AFTER command does not print. AFTER strings also do not print if you replace #MISSING with some other value (such as 0).
Adding blank spaces in a report draws the reader to key information, such as totals.
You can use the following commands to change how data values display in the final report.
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 the selection and sorting of 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.
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 either define your own generation and level names, or you can use the default names provided by Analytic Services. For a discussion, including examples, of generations and levels, 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 do not need to change the report if the member name is changed or deleted from the database outline.
Note: Generation and level names are stand-alone commands. You cannot use them in place of member names in report extraction or formatting commands. For example, you cannot use them with the <DESCENDANTS or <CHILDREN commands.
To use default level names add the following to the report script:
At the point in the script where you want to select a member by the default level name, use the following format:
Levn,dimensionName
dimensionName is the name of the dimension from which you want to select the members.
Note: Do not put a space after the comma.
For example, Lev1,Year selects all the level 1 members of the Year dimension.
To use default generation names add the following to the report script:
At the point in the script where you want to select a member by the default generation name, use the following format:
Genn,dimensionName
where n is the generation number.
dimensionName is the name of the dimension from which you want to select the members.
Note: Do not put a space after the comma.
For example, Gen2,Year selects all the generation 2 members of the Year dimension.
Note: These default generation and level names are not displayed in Outline Editor.
The following example is based on the Sample Basic database. It 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 !
The report script produces the following report:
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 create and identify dynamic members in the database outline; they are members that are calculated only during user retrieval requests, such as generating a report script. The time dimension has 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:
Generation Name |
Reserved Names |
Explanation |
---|---|---|
See Applying Predefined Generation Names to Dynamic Time Series Members for information about creating and maintaining Dynamic Time Series generation names in the database outline.
Note: 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 add the following to the report script:
At the point in the script where you want to select a Dynamic Time Series member, use either of the following formats:
<LATEST memberName
where memberName is the name of the member in the time dimension.
The <LATEST command is a global command that is applied to the entire report script, and is an aggregation based on the lowest level member within the dimension.
reservedName(memberName)
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.
Note: You must type the Dynamic Time Series string exactly as it is displayed in the database outline; you cannot create your own string and incorporate it into the final report.
You can create an alias table for the Dynamic Time Series members in the database outline, and use the aliases instead of the predefined generation names.
Boolean operators let you specify precise member combinations within a report, which is particularly 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 add the following to the report script:
At the point in the script where you want to use linking, enter the following 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.
Note: You must select members from the same dimension, and all extraction command arguments must be enclosed in parentheses, as in the example above. NOT can only be associated with an extraction command, and does not apply to the entire expression.
You can use Boolean operators with member selection commands, such as UDA and wildcards. See the Technical Reference for a list of all valid extraction commands that can be used in conjunction with the LINK command.
<LINK ((<IDESCENDANTS("100") AND <UDA(Product,Sweet)) OR ONSAMELEVELAS "100"-10")
selects sweet products 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")
selects products that are not sweet from the "100" subtree, plus all products on the same level as "100-10.
See the Technical Reference for additional examples of narrowing member selection criteria.
Substitution variables act as global placeholders for information that changes regularly; you set the substitution variables on the server through Essbase Administration Services, MaxL, or ESSCMD, and assign a value to each variable. You can then change the value at any time, reducing manual changes to a report script. You must have the role of at least Database Designer 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. Analytic Services dynamically updates the information when you run the final report.
See Using Substitution Variables for a comprehensive discussion of creating and changing substitution variables in the database outline. See the Technical Reference for information about the leading & character.
You can set substitution variables at the following levels:
To use a substitution variable add the following to the report script:
The substitution variable must be accessible from the application and database against which you are running the report.
At the point in the script where you want to use the variable, use the following format:
&variableName
where variableName is the same as the substitution variable set on the server.
<ICHILDREN &CurQtr
<ICHILDREN Qtr1
Note: The variable name can be an alphanumeric combination whose maximum size is specified in Limits. You cannot use spaces or punctuation in the variable name.
When you run the report script, Analytic Services 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 two or more 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 flavored juice and orange flavored juice were sold in New York during the first quarter.
To select a member based on a specific attribute add the following to the report script:
At the point in the script where you want to select members based on a specific attribute, use the following format:
<ATTRIBUTE memberName
where memberName is the name of an attribute-dimension member; for example:
<ATTRIBUTE Bottle
returns all products packaged in bottles.
There can be cases where attribute dimensions have members with the same name. For example, the attribute dimension Ounces and the attribute dimension Age can each have a member named 24. To ensure that a query returns correct results, you must 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. For a description of each attribute type, see Understanding Attribute Types.
You can select all the 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)
Note: 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))
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")
Note: The types of date format supported are mm-dd-yyyy or dd-mm-yyyy. The date must be between January 1, 1970 and January 1, 2038 (inclusive).
A user-defined attribute (UDA) enables you to select and report on data based on a common characteristic. These attributes are particularly useful when performing member selections from an outline with an unbalanced hierarchy (a hierarchy where 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 Designer 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. Hence, for data analysis, UDAs are not as powerful as attributes.
You can use the UDA command in conjunction with Boolean operators to refine report queries further. See Selecting Members by Using Boolean Operators for examples of the UDA command being used with a Boolean operator.
See Creating UDAs for information about creating and maintaining UDAs.
To select members based on a UDA add the following to the report script:
At the point in the script where you want to select members based on the UDA, use the following 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, Analytic Services incorporates the UDA members into the final report.
Note: You must type the UDA string exactly as it is displayed in the database outline; you cannot create your own UDA string and incorporate it into the report script.
You can use wildcards to select either members, generation, or level names in a report script. If you use member names, Analytic Services searches the member and all descendants of that member. If you specify a generation or level name, Analytic Services searches only members of that generation or level.
Using wildcards reduces the amount of 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 add the following to the report script:
At the point in the script where you want to select members using a trailing wildcard, use the following 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. Using the Sample Basic database,
<MATCH (Year,"J*")
To select members using a pattern-matching wildcard add the following to the report script:
At the point in the script where you want to select members using a pattern-matching wildcard, use the following format:
<MATCH (memberName,"???characters")
where memberName is the name of the member to select, and characters are the characters in the following member. Using the Sample Basic database,
<MATCH (Product,"???-10")
returns 100-10, 200-10, 300-10, and 400-10.
Note: In the Sample Basic database example, three question marks are used to represent the variable three characters in the string. If only two question marks were used in the example, no matches are found. You can place question mark wildcards anywhere in the match string.
Static member names are unchanging member names, such as Sales and COGS, that you enter directly into the report script. Although they are easy to establish, static member name definitions can be difficult to maintain if the database outline changes. You must change the member name in every script that is used with that database.
In general, report scripts are easier to maintain if you use generation and level names, or member selection commands, rather than static member names whenever possible. For example, when you remove a product, such as Widgets, from the dimension, the member selection command <children Product works, but a specific list referencing Widgets as a static member name generates the following error message:
"Unknown Member [Widgets]."
Static members tend to be particularly difficult to maintain when dealing with distributed OLAP databases, where both source and target databases must be consistent.
Note: These user-defined, static member generation and level names are not displayed in Outline Editor.
The following report script uses a static member called ProductGroups to select all the Level 1, Product member names from the Sample Basic database.
<PAGE(Year) <COLUMN(Product) <ROW (Measures) Qtr1 ProductGroups Sales Profit !
The report script produces the following report:
Qtr1 Market Scenario 100 200 300 400 Diet ======== ======== ======== ======== ======== Sales 25,048 26,627 23,997 20,148 25,731 Profit 7,048 6,721 5,929 5,005 7,017 |
When you run a report that includes static member definitions, the report displays members in order of their definition in the report script by member name. Sort commands have no effect on static member definitions. See Sorting Members for a discussion of the effects of sorting members.
You can suppress the display of duplicate shared members when you extract data for a report. You can only suppress shared member display in conjunction with the following items:
Suppressing shared members is useful when you want to eliminate unnecessary duplication of data within the report.
To suppress shared members add the following to the report script:
At the point in the script from which you want to suppress a shared member, use
<SUPSHARE
This command suppresses the display of shared members for the duration of the report script. Use the <SUPSHAREOFF command to reset the display of shared members in the script.
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.
For a complete listing of alias commands, see the Technical Reference.
You can display members in a report as a combination of the member name and its alias. Combining the member name and alias lets you display more descriptive page, column, and row names, such as Diet Cola 100-20 or 100-30 Caffeine Free Cola.
To display a member name and alias, use the <OUTALTNAMES and <OUTALTMBR commands together in a report script, as illustrated in the following example:
<PAGE (Product, Measures) <COLUMN (Scenario, Year) {OUTALTNAMES} <OUTALTMBR Actual <ICHILDREN Qtr1 <ROW (Market) <IDESCENDANTS "300" !
The report script produces the following report:
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 either 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 any 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.
For a list of sorting commands syntax and descriptions, see the Technical Reference.
Several Report Writer commands let you perform conditional retrieval and data sorting in reports.
For the syntax, definitions, and detailed examples of these commands, see the Technical Reference.
Configurable variables are used during conditional retrievals. For information about setting the Report Writer configurable variables, 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).
Analytic Services extracts data and applies restrictions and ordering in the following order:
Analytic Services then returns rows and displays output.
<TOP, <BOTTOM, and <ORDERBY commands sort the output of a report by its data values. Analytic Services applies <TOP and <BOTTOM first, followed by <ORDERBY. If the report contains a sort command, such as <SORTMBRNAMES, which sorts members and not data, Analytic Services applies the sort command first, followed by <TOP and <BOTTOM, and then <ORDERBY. <ORDERBY is the final sort that takes place.
The arguments of the <RESTRICT command let you specify qualifications for selecting rows. Analytic Services 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.
Analytic Services 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)...)
Only one <RESTRICT is allowed per report, as terminated by the ! command. If a report script contains more than one report, each <RESTRICT overwrites the one in the previous report, as illustrated in the following 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 more than one report, each <ORDERBY overwrites the one in the previous report.
Follow these guidelines when using the <ORDERBY command in a report script:
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.
Note: 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.
Caution: Analytic Services 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.
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))
This command returns the following rows:
This example returns two rows with the lowest data values in col2 (Actual, Qtr2) per row group.
3- BOTTOM ("market", 2, @DATACOL(2))
This command returns the following rows:
Note: <TOP and <BOTTOM put an upper limit on the number of (qualified) rows returned after all restrictions are applied. This upper limit is equal to the number of rows in the <TOP plus the number of rows in the <BOTTOM commands.
When using the <TOP and <BOTTOM commands, be aware that some other commands affect their operation. In particular, Analytic Services treats the <SUPPMISSING, <SUPZEROS, and <SUPEMPTYROWS options as restrictions and applies them to the extracted rows along with the <RESTRICT command restrictions. Analytic Services 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. Analytic Services 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, you should 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.
Note: Currency conversion is not supported across transparent partitions.
For information about creating a currency conversion application, see Building Currency Conversion Applications and Performing Conversions.
For the syntax and definitions of Report Writer commands, see the Technical Reference.
Use the following table to determine the report API calls that you can make:
See the API Reference for syntax and descriptions of these API functions.
![]() |