How to make query based on logged in user

好久不见. 提交于 2020-01-05 07:24:57

问题


I am new to JasperReports Server.

I am having different campaigns in my DB. And users assigned to these campaigns.

I want my JR Server user to provide campaign IDs to run a report. For this, I have create a query and an input control to show the list of campaigns in a list to take input from user.

The query I created shows all the campaigns in the DB.

I want to show only those campaigns in which the logged in user is assigned.

Is there any way to do this in JasperReports Server?


回答1:


It should work like this:

SELECT campaign_name
FROM some_table
INNER JOIN some_other_table sot ON ( ... )
WHERE sot.username = $P{LoggedInUsername}

In the documentation you'll find more comprehensive explanations and lists of available parameters.



来源:https://stackoverflow.com/questions/12091582/how-to-make-query-based-on-logged-in-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!