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.
Screenshot for Step
2 . Click New > Variable Prompt.
Screenshot for Step
The New Prompt dialog box appears.
Screenshot for Step
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.
Screenshot for Step
d. Select Choice List for User Input.
Screenshot for Step
e. Select All Column Values for Choice List Values.
Screenshot for Step
The dialog box should look like this:
Screenshot for Step
4 . a. Click Select Column and, in the Select Column dialog box, select Sales Person > E1 Sales Rep Name.
Screenshot for Step
b. Click OK. The dialog box should look like this:
Screenshot for Step
Expand the Options section.
5 . Select Specific Value from the "Default selection" drop-down list.
Screenshot for Step
Click the Select Values icon.
Screenshot for Step
6 . In the Select Values dialog box, select Angela Richards and then, click OK.
Screenshot for Step
7 . The New Prompt dialog box should look like this:
Screenshot for Step
Click OK. The newly created variable prompt is displayed in the prompts definition list.
Screenshot for Step
8 . Save the prompt as SalesRep Variable Prompt in your Regional Revenue folder.
Screenshot for Step
9 . Click the Preview icon (Screenshot for Step) to preview the prompt.
Screenshot for Step
Close the Preview window.

Using a Presentation Variable in a Static Text View

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:
  • Customers > Cust Regions > C50 Region
  • Customers > Cust Regions > C52 Country Name
  • Sales Person > E1 Sales Rep Name
  • Base Facts > 1 Revenue
Screenshot for Step
2 . Add ascending column sorts in this sequence: C50 Region, C52 Country Name, and E1 Sales Rep Nameas shown below:
Screenshot for Step
The Criteria tabbed page should look like this after adding the sorts:
Screenshot for Step
3 . Select the Results tabbed page.
Screenshot for Step
4 . Select New View > Other Views > Static Text.
Screenshot for Step
5 . Move the Static Text view above the Table view.
Screenshot for Step
Click the Edit View icon on the Static Text view. The Static Text editor appears.
Screenshot for Step
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']}
Screenshot for Step
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.
Screenshot for Step
Screenshot for Step
Your analysis should look like this:
Screenshot for Step
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 ".
Screenshot for Step
9 . a. In the New Filter dialog box, click Add More Options and select Presentation Variable.
Screenshot for Step
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".
Screenshot for Step
c. Click OK. The filter should look like this:
Screenshot for Step
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.
Screenshot for Step
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.
Screenshot for Step
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.
Screenshot for Step
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:
Screenshot for Step
15 . Click the Collapse icon for the first column to minimize it.
Screenshot for Step
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.
Screenshot for Step
Click Apply. The dashboard displays the presentation variable as Chris Jones.
Screenshot for Step
This concludes the topic of Presentation Variables and Filters.

No comments:

Post a Comment

Popular Posts