A POV population query can be edited depending on the user who requests the acceptable values or according to environment variables.


In the first case, two special placeholders, '##user##' and '##group##', can be inserted in the text of the query and they are substituted to runtime with appropriate values: 

  • ##user## placeholder, in a query, will be substituted by the current username,
  • ##group## placeholder will run as many queries as the groups the user belongs to: in each query a group will be substituted to a placeholder and the query result is put in UNION with the others.



Example:

 

Store table is defined as:

 

STORE(STORE_ID, STORE_DESCRIPTION, MARKET);

 

STORE_IDSTORE_DESCRIPTIONMARKET
1

Lorem ipsum dolor sit amet, 

USA
2

consectetur adipiscing elit. 

USA
3

Curabitur consequat elit ultricies pretium faucibus. 

EUROPE
4

Morbi enim leo, imperdiet nec facilisis at, malesuada quis leo

EUROPE



The aim is to have a POV showing the stores the user is resposible for. 

In order to get this, create two groups USA and EUROPE and assign users to groups according to their responsibilities.

The population query will be as follows:


SELECT STORE_ID, STORE_DESCRIPTION FROM STORE WHERE MARKET = '##group##'


At runtime, the system will evaluate the groups the user belongs to, and will make substitutions and finally carry out the UNION. 

Users that belong to the USA group will only see stores 1 and 2, users they belong to EUROPE they will see stores 3 and 4: if they belong to both groups, they will see all the stores as available values for POV.


Besides the mentioned placeholders, '$$variable_name$$' is substituted to runtime with the value of the variable indicated between the $$ symbols.