Hi,
Please let me know how I can render data objects in a report in report studio based on user session.
For eg, I have a list and a crosstab in a report. I would like to allow user A access to the List only when he logs in and runs the report, allow user B to access the crosstab only when he runs the report, similarly user X should be able to log in to both the List and the Crosstab and so on ........
How can I do this?
Regards
you are using same query for list and crosstab or different ?
use Bursting Report
Hi,
I am using the same query for the list and crosstab.
for ex: Year, Product Line, Quantity, Revenue
some users should be able to access only the list, others only the crosstab and some should be able to access both the objects. A condition is required that dynamically provides access to the user when he runs the report. :)
How would you decide which user sees which objects? Is there something in your database or authentication source that would determine this?
Assuming that you have same query for both list and Cross tab.
create below calculation name it as user. It will capture the user name who is running the report and make the groups based on requirement like U1 see list ,U2 see crosstab and All will see both.
if(#sq($account.defaultName)#='XXXXXX') then
('U1')
else
if(#sq($account.defaultName)#='YYYYYY') then
('U2')
else
('All')
then create a string variable as
if([Query1].[User]='U1') then
('U1')
else
if([Query1].[User]='U2') then
('U2')
else
('All')
Add column user in both List and Crosstab. And in render variable property select string variable.
set U1 and ALL check box for List and U2 and All check box for Crosstab. (Refer Conditional rendering in Cognos for more details)
Then see you are getting desired result. You can set box type to None for user column after that.
It might be better to use the session parameter $account.personalInfo.userName since it will be unique within your authentication protocol, whereas $account.defaultName may not be unique.
It works!. Thank you very much half blood prince.
Thank you Dys for your suggestion. :)