OPRID

Syntax

OPRID ()

Description

The OPRID function returns the user ID of the user who currently has the analytic instance checked out.

Use the OPRID function within a filter user function whose purpose is to limit user ID access to only certain rows of data.

Example

IF(AT(USERID, TXT2MBR(USERID, OPERID()), 
DEPT_CUBE) =  MEMBER(DEPT_DIM),RETURN(1), RETURN(0))

This filter user function restricts user access to bonus amount data. Each user ID has access to only the bonus amount that pertains to them. The filter user function contains these data cubes and dimensions:

  • USERID dimension, which is mapped to the USERID field.

    The USERID field contains the user IDs of the users that currently have the analytic instance loaded.

  • DEPT_CUBE data cube, which is mapped to the DEPT_CUBE field.

    This data cube is formatted as a member of the DEPT_DIM dimension.

  • DEPT_DIM dimension, which is mapped to the DEPT_DIM field.

    Note:

    The filter user function is applied to this dimension.

  • BONUS_AMT data cube, which is mapped to the BONUS_AMT field.

The following table lists the values of the fields that are mapped to the USERID dimension and DEPT_CUBE data cube.

USERID DEPT_CUBE

Juan

Doc

Albert

Dev

Nigel

PM

The following table lists the values of the fields that are mapped to the DEPT_DIM dimension and BONUS_AMT data cube.

DEPT_DIM BONUS_AMT

Dev

5000

Doc

4000

PM

7000

The analytic calculation engine performs these steps to calculate the filter user function:

  1. The OPRID function returns the user ID of the current user in text format.

  2. The TXT2MBR function compares the user ID with the member in the USERID dimension to determine if they match.

    If the user ID matches the member in the USERID dimension, the AT function searches for the coordinates of the user ID member that is returned by TXT2MBR and returns the corresponding value of DEPT_CUBE.

    On the right-hand side of the equation, the MEMBER function returns the corresponding member of DEPT_DIM.

  3. The analytic calculation performs one of these actions:

    • If the value returned from DEPT_CUBE matches the member returned from DEPT_DIM, the user ID can see the bonus amount.

      For example, the Dev value returned from DEPT_CUBE matches the Dev member returned from DEPT_DIM. For this reason, Albert can see his bonus amount of 5000.

    • If the value returned from DEPT_CUBE does not match the member returned from DEPT_DIM, the user ID cannot see the bonus amount.