Variable and @variable functions in Business Objects

Variable : Formula with a name.
It can be used with every report feature and can be used anywhere on the report.

The @Variable function syntax:
@Variable(‘‘)

@Variable(‘BOUSER’)
BOUSER : contains username with which you login.

@variable() function is not meant to be used for prompts but can act like @prompt. There are some limitations using @Variable() function:

– you don’t have parameters such as @prompt ()
– you can’t control type
– you can’t use LOVs in @variable ()
– you can’t have default value in @variable ()
– you can’t have multi select in @variable ()
– multiple @variable () you can’t control the display order.

Business Objects Official @Variable definition:

The @Variable function is used, for example, in the WHERE clause to call the value assigned to one of the following types of variables:
• BusinessObjects system variables
• Report variables
• Language (Locale) variables
• Operating system variables
• Custom variables for Desktop Intelligence

BusinessObjects system variables
• BOUSER – user login
• DBUSER – database user name
• DBPASS – database user password

(The returned data is then restricted based on that BusinessObjects
user’s login.)

Report variables
• DOCNAME – the name of the document
• DPNAME – the name of the Data Provider
• DPTYPE – the type of the Data Provider
• UNVNAME – the name of the universe
• UNVID – the ID of the universe used

the Begin_SQL parameter that will be executed before the SELECT statement. This can be used for audit purposes concerning the use of the database. ( To determine which report query or which universe is used most frequently).

Operating system variables : You can enter Windows environment
variables in order to obtain information about your installation.

You can use the @Variable function with BusinessObjects system variables to restrict data according to the identity of the currently logged in BusinessObjects user.

In the universe for a human resources database, you have an object called Employee name. You want to restrict the returned data for Employee name to the values authorized in the database for each user. This would allow you to control what employee information each user is allowed to see.

Employees.Employee_Name = @Variable(‘BOUSER’)
When the object Employee name is used in a query, the data is returned only for the value in the tables that matches the BOUSER value.

Using locale variables:
SELECT *
FROM PRODUCT
WHERE PRODUCT.LANG = @Variable(PREFERRED_VIEWING_LOCALE)

At query time, the variable is replaced by the correct value.

Using report variables
The variables can be referenced in:
• The definition of an object: SELECT, WHERE clauses, etc …
• Filters
• The Join expression
• The Begin_SQL parameter

You can enter windows environment variables in order to obtain information about your installation. For example, NUMBER_OF_PROCESSORS, USERNAME.

If you include the following @Variable(NUMBER_OF_PROCESSORS) in a query, the response will include the number of processors on the machine you are using.

Leave a Reply