问题
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