COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: mlodugu1 on 10 Apr 2016 11:53:30 AM

Title: How to render objects in a report based on user session
Post by: mlodugu1 on 10 Apr 2016 11:53:30 AM
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
Title: Re: How to render objects in a report based on user session
Post by: HalfBloodPrince on 12 Apr 2016 04:48:10 AM
you are using same query for list and crosstab or different ?
Title: Re: How to render objects in a report based on user session
Post by: afzaki7 on 12 Apr 2016 05:38:55 AM
use Bursting Report
Title: Re: How to render objects in a report based on user session
Post by: mlodugu1 on 13 Apr 2016 12:34:53 PM
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.  :)
Title: Re: How to render objects in a report based on user session
Post by: bdbits on 13 Apr 2016 03:57:25 PM
How would you decide which user sees which objects? Is there something in your database or authentication source that would determine this?
Title: Re: How to render objects in a report based on user session
Post by: HalfBloodPrince on 14 Apr 2016 04:39:24 AM
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.
Title: Re: How to render objects in a report based on user session
Post by: dys on 14 Apr 2016 09:27:31 PM
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.
Title: Re: How to render objects in a report based on user session
Post by: mlodugu1 on 16 Apr 2016 05:57:22 AM
It works!. Thank you very much half blood prince.
Thank you Dys for your suggestion.  :)