![]() Previous |
![]() Next |
The INFO (PARSE) function obtains information produced by a PARSE statement and stored internally by Oracle OLAP. Through the use of keywords, INFO lets you extract specific pieces of information about the expression that you have parsed.
Return Value
The return value depends on the keyword you use, as described in Table: INFO PARSE Keywords. When you try to extract unavailable information or use an index that is out of range, INFO returns NA
. For example, if you parse a phrase that contains four expressions and then ask for the twelfth FORMULA, INFO returns NA
.
Syntax
INFO(PARSE choice [index])
Parameters
Indicates that you want to obtain information produced by a PARSE statement.
The specific information you want. The choices available for PARSE are listed in Table: INFO PARSE Keywords. Choices marked as indexed can take the optional index argument.
An INTEGER expression that specifies which result you want for a choice that can have several different results. For example, when you parse text that contains three expressions, each expression has its own formula and data type. You would use index to specify which expression you are interested in.
When you omit index, INFO returns all the information as a multiline value.
INFO PARSE Keywords
Keyword | Type | Indexed? | Meaning |
---|---|---|---|
PARSEABLE |
BOOL |
No |
Was Oracle OLAP able to parse the text? |
ERRORTEXT |
TEXT |
No |
The text of an error message when the expressions were not parsed. |
NUMFORMULAS |
INT |
No |
The number of expressions (formulas) that were parsed. |
NUMDIMS |
INT |
No |
The number of dimensions in the union of all the expressions that were parsed. |
FORMULA |
TEXT |
Yes |
The text (formula) of the specified expression; index specifies which one you want. |
DATA |
TEXT |
Yes |
The data type of the specified expression. |
TYPE |
TEXT |
Yes |
The type of object of the specified expression; when the expression is the name of an object, it returns the type; when the expression is a qualified data reference, it returns QDR; when the expression is anything else, it returns EXP. |
DIMENSION |
TEXT |
Yes |
The name of the specified dimension in the union of all dimensions of the expressions. |
Examples
Getting Parsed Information
In a simple report program, you want to allow the user to specify the data to be reported as an argument to the program. You want to allow the user to specify an expression and the name of a data variable. You cannot process expression arguments with an ARGS statement, so you use PARSE and INFO to parse the program arguments and produce the report.
The following statements create a simple report program.
DEFINE report1 PROGRAM PROGRAM PUSH month product district DECIMALS DECIMALS = 0 LIMIT month TO FIRST 2 LIMIT product TO ALL LIMIT district TO 'Chicago' PARSE ARGS REPORT ACROSS month: WIDTH 8 <&INFO(PARSE FORMULA 1) - WIDTH 13 &INFO(PARSE FORMULA 2)> POP month product district DECIMALS END
When users run the program, they can supply either the name of a variable (sales
) or an expression (sales-expense
) or both as arguments.
The following statement
REPORT1 sales sales-expense
produces the following output.
DISTRICT: CHICAGO --------------------MONTH-------------------- --------Jan95--------- --------Feb95--------- PRODUCT SALES SALES-EXPENSE SALES SALES-EXPENSE ------------ -------- ------------- -------- ------------- Tents 29,099 1,595 29,010 1,505 Canoes 45,278 292 50,596 477 Racquets 54,270 1,400 58,158 1,863 Sportswear 72,123 7,719 80,072 9,333 Footwear 90,288 8,117 96,539 13,847