Question

How to control report definition where clause argument based on access group

Select Name, Age from Employee  where  (if access group Manager ) id = '100'  else if (access goup employee) id ='200';

***Updated by moderator: Lochan to update Categories***

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

August 18, 2016 - 1:26am

Hi John,

With the hlep of data page you can check the access group and get the required fileter value which can passed to RD directly.

Don't forget to mention the data page on pages and classes tab of RD.

Hope this helps..!!

August 18, 2016 - 1:58am

Hi John Create the RD with paramter ID. Use param.ID in where clause

Using RD in layout:

  • Have two layouts with Visible when condition. One for manager access group and other for employee access group 
  • For manager visible layout call RD with ID paramter '100'
  • For employee visible layout call RD with ID paramter '200'

Using RD in Activity:

  • Use can use the same logic to property-set  param.ID value before calling RD.

 

Thanks,

Prem

Pega
August 18, 2016 - 2:24am

You can also you an SQL function (CASE WHEN) if the way to figure out the manager is part of row itself or is being passed as a parameter to the report definition. Please refer - https://pdn.pega.com/how-create-custom-sql-functions-reporting

August 18, 2016 - 8:02pm
Response to nistr

How to refer access group in a SQL query ?

Pega
August 22, 2016 - 9:58am

A SQL function can be created with a set of parameters and when used within a report definition, it can take values from the pages defined in the pages and classes tab of the report definition. The value of the access group of the user logged in will be available on the clipboard and you can use the property AccessGroup.pyAccessGroup as the parameter to the function.