Wednesday, October 24, 2012

Using a Presentation Variable in a Static Text View


Using a Presentation Variable in a Static Text View

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