How to pass the current username as an input to an Information link stored procedure

How to pass the current username as an input to an Information link stored procedure

book

Article ID: KB0081881

calendar_today

Updated On:

Products Versions
Spotfire Server All supported versions

Description

In some cases a database stored procedure might require the current logged in username as an input to perform some operations on the database.

eg:-Insert information in a database table like comments from the logged on users analyzing the spotfire reports.In such scenarios it is useful to pass the current username to the stored procedure to identify individual comments.

Issue/Introduction

Spotfire provides an ability to create personalized information links with a filter parameter %CURRENT_USER% ,which provides the row level security. The same parameter can also be passed on to a database stored procedure which needs the current username as an input.

Resolution

For stored procedures,  the variable %CURRENT_USER% needs to be specified as the default value of the input parameter to the database procedure. This means that your database stored procedure needs to take the username as input parameter. 

Here are the steps to setup the procedure element:

1) Launch Spotfire Analyst, then click on Tools and Information Designer 
2) Navigate to and edit the Stored Procedure element. This should show all input parameters to the stored procedure 
3)To pass on the current user as an argument to the procedure just double-click on the Default value field of the associated database parameter, and enter %CURRENT_USER% while leaving the drop-down for Prompt set to 'None.'

No other changes are required to be done at the information link sql.

Additional Information

https://docs.tibco.com/pub/sfire-analyst/7.8.0/doc/html/en-US/TIB_sfire-analyst_UsersGuide/index.htm

Attachments

How to pass the current username as an input to an Information link stored procedure get_app