OBIEE 11G Using a Presentation Variable
A
presentation variable can be created as part of the process for creating a
column prompt or a variable prompt. When the presentation varaible is part of a
column prompt, it is associated with a specific column and takes on that
column's value. It is part of a variable prompt, you define the values that the
prompt can have as it is not associated with any specific column. The name and
value of the presentation variable is determined by the user when it is
initially declared or when it is referenced in the analysis, dashboard, or
agent.
Note: You have already created and used a presentation variable when you added a Narrative view to your analysis.
To add a presentation variable using a variable prompt, perform the following steps:
1 .
|
Create
a new variable dashboard prompt that creates a Sales Representative
presentation variable.
a. Click New > Dashboard Prompt and select Sample Sales as the subject area. |
2 .
|
Click
New > Variable Prompt.
The New Prompt dialog box appears.
|
3 .
|
a. Accept Presentation
Variable as the default prompt type.
b. In the text box to the right of the drop-down list for the prompt type, enter the same variable that you entered in the Static Text editor, VarSalesRep. c. Enter Sales Representative Name: in the Label text box. d. Select Choice List for User Input.
e. Select All Column Values for Choice List Values.
The dialog box should look like this: |
4 .
|
a. Click Select
Column and, in the Select Column dialog box, select Sales Person >
E1 Sales Rep Name.
b. Click OK. The dialog box should look like this:
Expand the Options section.
|
5 .
|
Select
Specific Value from the "Default selection" drop-down list.
Click the Select Values icon. |
6 .
|
In
the Select Values dialog box, select Angela Richards and then, click OK.
|
7 .
|
The
New Prompt dialog box should look like this:
Click OK. The newly created variable prompt is displayed in the prompts definition list. |
8 .
|
Save
the prompt as SalesRep Variable Prompt in your Regional Revenue
folder.
|
9 .
|
Close the Preview window. |
Create
an analysis that uses the VarSalesRep presentation variable in a Static Text
view and in a Filter.
A Static Text view adds static text in the results.
1.
|
Create
an analysis by selecting the following columns:
|
2. Add ascending column sorts in this sequence: C50 Region, C52 Country Name, and E1
Sales Rep Nameas shown below:
The Criteria tabbed page should look like this after adding the sorts:
|
|
3 .
|
Select
the Results tabbed page.
|
4 .
|
Select
New View > Other Views > Static Text.
|
5 .
|
Move
the Static Text view above the Table view.
Click the Edit View icon on the Static Text view. The Static Text editor appears. |
6 .
|
In
the Static Text editor, reference the VarSalesRep variable. Enter the
following syntax in the Static Text pane: This analysis is for the Sales Rep @{VarSalesRep}.
The syntax for referencing a Presentation variable is as follows:
@{variables.variablename}[format]{defaultvalue} or
@{scope.variables['variablename']}
Where:
variablename is the name of the presentation or request variable format (optional) is a format mask dependent upon the data type of the variable, for example #, ##0, MM/DD/YY hh:mm:ss. (Note that the format is not applied to the default value.) default value (optional) is a constant or variable reference, indicating a value to be used if the variable referenced by variablename is not populated scope identifies the qualifiers for the variable.
You need to specify the
scope when a variable is used at multiple levels (analyses, dashboard pages,
and dashboards) and you want to access a specific value. (If you do not
specify the scope, then the order of precedence is analyses, dashboard pages,
and dashboards.
Examples: @{variables.MyFavoriteRegion}{EASTERN REGION} or @{dashboard.variables['MyFavoriteRegion']} Observe that your entry is previewed below the Static Text text box. Click Done. |
7 .
|
Save
your analysis as Sales Reps by Region and Country.
Your analysis should look like this:
|
8 .
|
a.
Select
the Criteria tabbed page.
b. In the Filters pane, click the Create a Filter icon and select "Sales Person "."E1 Sales Rep Name ". |
9 .
|
a.
In
the New Filter dialog box, click Add More Options and select Presentation
Variable.
b. In the Variable Expr field, enter the variable name, VarSalesRep. Notice that you can also specify a default for the variable, but in this case the default is driven by the variable prompt, which is set to default to "Angela Richards". c. Click OK. The filter should look like this: |
10 .
|
Select
the Results tabbed page. Because the variable dashboard prompt has not been
run, the VarSalesRep presentation variable has not been populated with a
value. Because of this, no results from the analysis meet the filter
requirement.
Save the analysis. |
11 .
|
Add
the analysis Sales Reps by Region and Country and the newly created
variable prompt to the Customer Detail dashboard.
|
12 .
|
Open
the dashboard Customer Detail from the Regional Revenue folder,
then click Page Options > Edit Dashboard.
|
13 .
|
Add
a new column next to Column 1, and then navigate to the Sales Reps by Region
and Country analysis and drag it to the new column.
|
14 .
|
Navigate
to SalesRep Variable Prompt in the catalog pane, and drag the prompt above
the Sales Reps by Region and Country analysis. Save the dashboard and run it.
The Dashboard view looks like this: |
15 .
|
Click
the Collapse icon for the first column to minimize it.
The dashboard runs and the variable dashboard prompt is preset to the default value, Angela Richards, which in turn appears in the Static Text view as expected and is used to filter the embedded analysis results. The value of a presentation variable is populated by the variable prompt. That is, each time you select a value in the variable prompt, the value of the presentation variable is set to that value. |
Click
the drop-down list for the dashboard prompt, and select Chris Jones.
Click Apply. The dashboard displays the presentation variable as Chris Jones.
This concludes the topic of Presentation Variables and Filters. |
No comments:
Post a Comment