如何根据登录用户进行查询 [英] How to make query based on logged in user

查看:141
本文介绍了如何根据登录用户进行查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 JasperReports服务器的新手

我的数据库中有不同的广告系列。分配给这些广告系列的用户。

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

我希望我的 JR服务器用户提供广告系列ID来运行报告。
为此,我创建了一个查询和一个输入控件,以显示列表中的广告系列列表,以便从用户那里获取输入。

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.

有没有办法在 JasperReports Server 中执行此操作?

Is there any way to do this in JasperReports Server?

推荐答案

它应该工作像这样:

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.

这篇关于如何根据登录用户进行查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆