Obiee 简明教程
OBIEE – Variables
在 OBIEE 中,通常使用两种类型的变量 −
In OBIEE, there are two types of variables that are commonly used −
-
Repository variables
-
Session variables
除此之外,您还可以定义演示和请求变量。
Apart from this you can also define Presentation and Request variables.
Repository Variables
存储库变量在任何时间点只有一个值。存储库变量使用 Oracle BI Administration 工具定义。存储库变量可以在表达式构建器向导中代替常量。
A Repository variable has a single value at any point of time. Repository variables are defined using Oracle BI Administration tool. Repository variables can be used in place of constants in Expression Builder Wizard.
有两种类型的存储库变量 −
There are two types of Repository variables −
-
Static repository variables
-
Dynamic repository variables
静态存储库变量在变量对话框中定义,并且其值存在,直到管理员更改它们。
Static repository variables are defined in variable dialog box and their value exists until they are changed by the administrator.
静态存储库变量包含数字或字符值,是默认初始化器。此外,您可以使用表达式构建器插入常量作为默认初始化器,例如,日期、时间等。您不能使用其他值或表达式作为静态存储库变量的默认初始化器。
Static repository variables contain default initializers that are numeric or character values. In addition, you can use Expression Builder to insert a constant as the default initializer, such as date, time, etc. You cannot use any other value or expression as the default initializer for a static repository variable.
在较旧的 BI 版本中,Administrator 工具没有限制静态存储库变量的值。如果您的存储库已从旧版本升级,您可能在一致性检查中收到警告。在这种情况下,请更新静态存储库变量,以便默认初始化器具有常量值。
In older BI versions, the Administrator tool did not limit value of static repository variables. You may get warning in consistency check if your repository has been upgraded from older versions. In such case, update the static repository variables so that default initializers have a constant value.
动态存储库变量与静态变量相同,但值由查询返回的数据刷新。在定义动态存储库变量时,请创建一个初始化块或使用一个包含 SQL 查询的现有块。您还可以设置一个计划,Oracle BI 服务器将按该计划执行查询并定期刷新变量的值。
Dynamic repository variables are same as static variables but the values are refreshed by data returned from queries. When defining a dynamic repository variable, you create an initialization block or use a preexisting one that contains a SQL query. You can also set up a schedule that the Oracle BI Server will follow to execute the query and refresh the value of the variable periodically.
当动态存储库变量的值发生更改时,自动删除与业务模型相关的所有缓存条目。
When the value of a dynamic repository variable changes, all cache entries associated with a business model are deleted automatically.
每个查询都可以刷新多个变量:查询中每列一个变量。您可以计划由 Oracle BI 服务器执行这些查询。
Each query can refresh several variables: one variable for each column in the query. You schedule these queries to be executed by the Oracle BI server.
动态存储库变量对于定义逻辑表源的内容很有用。例如,假设您有两个有关订单的信息源。一个源包含当前订单,另一个包含历史数据。
Dynamic repository variables are useful for defining the content of logical table sources. For example, suppose you have two sources for information about orders. One source contains current orders and the other contains historical data.
Create Repository Variables
在管理工具中 → 转到管理 → 选择变量 → 变量管理器 → 转到操作 → 新建 → 存储库 > 变量。
In the Administration Tool → Go to Manage → Select Variables → Variable Manager → Go to Action → New → Repository > Variable.
在变量对话框中,键入变量的名称(所有变量的名称应唯一) → 选择变量的类型 - 静态或动态。
In the Variable dialog, type a name for the variable (Names for all variables should be unique) → Select the type of variable - Static or Dynamic.
如果您选择动态变量,请使用初始化块列表选择一个现有的初始化块,该块将用于持续刷新值。
If you select dynamic variable, use the initialization block list to select an existing initialization block that will be used to refresh the value on a continuing basis.
要创建一个新的初始化块 → 单击新建。要添加默认初始化器值,请在默认初始化器框中键入该值,或单击表达式构建器按钮以使用表达式构建器。
To create a new initialization block → Click New. To add a default initializer value, type the value in the default initializer box, or click the Expression Builder button to use Expression Builder.
对于静态存储库变量,您在默认初始化器窗口中指定的的值将保留。除非您更改它,否则它不会更改。如果您使用字符字符串初始化变量,请用单引号将字符串括起来。静态存储库变量必须具有常量值的默认初始化器 → 单击确定关闭对话框。
For static repository variables, the value you specify in the default initializer window persists. It will not change unless you change it. If you initialize a variable using a character string, enclose the string in single quotes. Static repository variables must have default initializers that are constant values → Click OK to close the dialog box.
Session Variables
会话变量类似于动态存储库变量,它们从初始化块中获取值。当用户开始会话时,Oracle BI 服务器会创建会话变量的新实例并初始化它们。
Session variables are similar to dynamic repository variables and they obtain their values from initialization blocks. When a user begins a session, the Oracle BI server creates new instances of session variables and initializes them.
会话变量的实例数量和 Oracle BI 服务器上的活动会话一样多。会话变量的每个实例都可以初始化为不同的值。
There are as many instances of a session variable as there are active sessions on the Oracle BI server. Each instance of a session variable could be initialized to a different value.
有两种类型的会话变量 −
There are two types of Session variables −
-
System session variables
-
Non-system session variables
系统会话变量由 Oracle BI 和表示服务器用于特定目的。它们具有预定义的保留名称,不能被其他变量使用。
System session variables are used by Oracle BI and Presentation server for specific purposes. They have predefined reserved names which can’t be used by other variables.
USER |
This variable holds the value the user enters with login name. This variable is typically populated from the LDAP profile of the user. |
USERGUID |
This variable contains the Global Unique Identifier (GUID) of the user and it is populated from the LDAP profile of the user. |
GROUP |
It contains the groups to which the user belongs. When a user belongs to multiple groups, include the group names in the same column, separated by semicolons (Example - GroupA;GroupB;GroupC). If a semicolon must be included as part of a group name, precede the semicolon with a backslash character (\). |
ROLES |
This variable contains the application roles to which the user belongs. When a user belongs to multiple roles, include the role names in the same column, separated by semicolons (Example - RoleA;RoleB;RoleC). If a semicolon must be included as part of a role name, precede the semicolon with a backslash character (\). |
ROLEGUIDS |
It contains the GUIDs for the application roles to which the user belongs. GUIDs for application roles are the same as the application role names. |
PERMISSIONS |
It contains the permissions held by the user. Example - oracle.bi.server.manageRepositories. |
非系统会话变量用于设置用户筛选器。例如,您可以定义一个名为 Sale_Region 的非系统变量,该变量将初始化为用户的销售区域名称。
Non-system session variables are used for setting the user filters. Example, you could define a non-system variable called Sale_Region that would be initialized to the name of the sale_region of the user.
Create Session Variables
在管理工具 → 转到管理 → 选择变量中。
In the Administration Tool → Go to Manage → Select Variables.
在变量管理器对话框中,单击操作 → 新建 → 会话 → 变量。
In the Variable Manager dialog, click Action → New → Session → Variable.
在会话变量对话框中,输入变量名称(所有变量的名称都应该唯一,系统会话变量的名称是保留的,不能用于其他类型的变量)。
In the Session Variable dialog, enter variable name (Names for all variables should be unique and names of system session variables are reserved and cannot be used for other types of variables).
对于会话变量,您可以选择以下选项 −
For session variables, you can select the following options −
-
Enable any user to set the value − This option is used to set session variables after the initialization block has populated the value. Example - this option lets non-administrators set this variable for sampling.
-
Security sensitive − This is used to identify the variable as sensitive to security when using a row-level database security strategy, such as a Virtual Private Database (VPD).
您可以使用初始化块列表选项来选择一个将用于定期刷新值的初始化块。您还可以创建一个新的初始化块。
You can use the initialization block list option to choose an initialization block that will be used to refresh the value regularly. You can also create a new initialization block.
要添加默认初始化器值,请在默认初始化器框中输入值或者单击表达式构建器按钮以使用表达式构建器。单击确定以关闭对话框。
To add a default initializer value, enter the value in the default initializer box or click the Expression Builder button to use Expression Builder. Click OK to close the dialog box.
管理员可以使用 Oracle BI 管理工具创建非系统会话变量。
The administrator can create non-system session variables using Oracle BI Administration tool.
Presentation Variables
表示变量是通过创建仪表盘提示创建的。可以用两种类型的仪表盘提示 −
Presentation variables are created with creation of Dashboard prompts. There are two types of dashboard prompts that can be used −
Column Prompt
使用 Prompt 列创建的 Presentation 变量与列关联,而它可以采用的值则来自列值。
Presentation variable created with column prompt is associated with a column, and the values that it can take comes from the column values.
要创建 Presentation 变量,请转到“新建 Prompt”对话框或“编辑 Prompt”对话框→在变量字段的“变量集”中选择“Presentation 变量”→输入变量的名称。
To create a presentation variable go to New Prompt dialog or Edit Prompt dialog → Select Presentation Variable in the Set of a variable field → Enter the name for the variable.
Variable Prompt
作为 Prompt 变量创建的 Presentation 变量与任何列都不关联,并且您需要定义它的值。
Presentation variable created as variable prompt is not associated with any column and you need to define its values.
要在“新建 Prompt”对话框或“编辑 Prompt”对话框中作为 Prompt 变量的一部分创建 Presentation 变量,请转到变量字段的 Prompt → 输入变量的名称。
To create a presentation variable as part of a variable prompt, in the New Prompt dialog or Edit Prompt dialog → Select Presentation Variable in the Prompt for field → Enter the name for the variable.
Presentation 变量的值由与之创建的列或变量 Prompt 填充。每次用户在列或变量 Prompt 中选择一个值时,Presentation 变量的值都将设为用户选择的值。
The value of a presentation variable is populated by the column or variable prompt with which it is created. Each time a user selects a value in the column or variable prompt, the value of the presentation variable is set to the value that the user selects.
Initialization Blocks
初始化块用于初始化 OBIEE 变量:Dynamic Repository 变量、系统会话变量和非系统会话变量。
Initialization blocks are used to initialize OBIEE variables: Dynamic Repository variables, system session variables and non-system session variables.
它包含用于初始化或刷新与该块关联的变量而执行的 SQL 语句。执行的 SQL 语句指向可以使用连接池访问的物理表。连接池在初始化块对话框中定义。
It contains SQL statement that are executed to initialize or refresh the variables associated with that block. The SQL statement that are executed points to physical tables that can be accessed using the connection pool. Connection pool is defined in the initialization block dialog.
如果希望初始化块的查询具有特定于数据库的 SQL,则可以为此查询选择数据库类型。
If you want the query for an initialization block to have database-specific SQL, you can select a database type for that query.
Initialize Dynamic Repository Variables using Initialization Block
初始化块的默认初始化字符串字段用于设置 Dynamic Repository 变量的值。您还可以定义 Oracle BI 服务器用于执行查询和刷新变量值的时间表。如果将日志级别设为 2 或更高,则用于检索变量值的所有 SQL 查询的日志信息将保存在 nqquery.log 文件中。
Default initiation string field of initialization block is used to set value of dynamic repository variables. You also define a schedule which is followed by Oracle BI server to execute the query and refresh the value of variable. If you set the logging level to 2 or higher, log information for all SQL queries executed to retrieve the value of variable is saved in nqquery.log file.
此文件在 BI 服务器上的位置:
Location of this file on BI Server −
ORACLE_INSTANCE\diagnostics\logs\OracleBIServerComponent\coreapplication_obisn
Initialize Session Variables using Initialization Block
会话变量也从初始化块获取其值,但其值从不随时间间隔而变化。当用户开始新会话时,Oracle BI 服务器将创建会话变量的新实例。
Session variables also take their values from initialization block but their value never changes with time intervals. When a user begins a new session, Oracle BI server creates a new instance of session variables.
如果在身份管理用户对象中将日志级别设为 2 或更高,或者在变量管理器中将 LOGLEVEL 系统会话变量设为 2 或更高,则 BI 服务器执行的所有 SQL 查询(用于检索会话变量信息)都会保存在 nqquery.log 文件中。
All SQL queries executed to retrieve session variable information by BI server if the logging level is set to 2 or higher in the Identity Manager User object or the LOGLEVEL system session variable is set to 2 or higher in the Variable Manager is saved in nqquery.log file.
此文件在 BI 服务器上的位置:
Location of this file on BI Server −
ORACLE_INSTANCE\diagnostics\logs\OracleBIServerComponent\coreapplication_obisn
Create Initialization Blocks in Administrator Tool
转到“管理器”→“变量”→将显示“变量管理器”对话框。转到“操作”菜单→单击新建→仓库→初始化块→输入初始化块的名称。
Go to Manager → Variables → Variable Manager Dialog box appears. Go to Action menu → Click New → Repository → Initialization Block → Enter the name of initialization block.
转到“时间表”选项卡→选择开始日期和时间以及刷新间隔。
Go to Schedule tab → Select start date and time and refresh interval.
您可以为初始化块选择以下选项:
You can choose the following options for Initialization Blocks −
-
Disable − If you select this option, initialization block is disabled. To enable an initialization block, right-click an existing initialization block in the Variable Manager and choose Enable. This option enables you to change this property without opening the initialization block dialog.
-
Allow deferred execution − This allows you to defer the execution of the initialization block until an associated session variable is accessed for the first time during the session.
-
Required for authentication − If you select this, initialization block must execute for users to log in. Users are denied access to Oracle BI if the initialization block doesn’t execute.