How to make query based on logged in user

2019-08-12 16:45发布

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条回答
霸刀☆藐视天下
2楼-- · 2019-08-12 17:42

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.

查看更多
登录 后发表回答