简体   繁体   English

如何过滤SSRS报告中的记录

[英]How to filter the records in SSRS report

I have been working in SSRS report where I need to show the records of the online users and the type of department they are logged in. 我一直在处理SSRS报告,需要在其中显示在线用户的记录以及他们登录的部门的类型。

the data I have in the DB are like this. 我在数据库中的数据就是这样。

Data         Type                 UserName   
10/02/2014   Login                Admin
10/02/2014   OperationsLoggedIn   Admin
10/02/2014   Logout               Admin
10/02/2014   Login                User
10/03/2014   OperationsLoggedIn   User
10/03/2014   FinanceloggedIn      ABC

Now I need to show in the SSRS report in the table. 现在,我需要在表格的SSRS报告中显示。 I just want to show the which are the users that are online and also need to check that the users listed shouldn't have logged out. 我只想显示哪些是在线用户,还需要检查列出的用户是否应该注销。

In this case I need to show 2 entry only. 在这种情况下,我只需要显示2个条目。

10/03/2014   OperationsLoggedIn   User
10/03/2014   FinanceloggedIn      ABC

The reason I don't want to show the admin entry is because he has already logged out. 我不想显示管理员条目的原因是因为他已经注销。 So how should I apply filtering in SSRS ? 那么我应该如何在SSRS中应用过滤?

The condition I want to check is : 我要检查的条件是:

1. Only OperationsLogedIn and FinaceLoggedIn should show
2. User should not have logged out.

Can anyone guide me for this ? 有人可以为此指导我吗?

I believe the first column [Data] must have DateTime so that we can identify the last/latest activity or Type of a particular user like Admin login @10AM & logout @11AM... Doing this way we need to get latest activity of user and then condition of whatever you want to include or exclude in SSRS Report 我相信第一列[Data]必须具有DateTime,以便我们可以识别特定用户的最新/最近活动或类型,例如Admin login @ 10AM和logout @ 11AM ...这样,我们需要获取用户的最新活动然后根据您想在SSRS报告中包括或排除的条件

SELECT * FROM
(Select Data,Type,UserName,Rank() Over(Partition By UserName Order By Data Desc) AS ActiveStatus
    From Table1
) LoginDetails Where ActiveStatus=1 --(To get current status of user)   

If you right click on your dataset and click 'Dataset Properties...', under the 'Filters' tab is where you can apply filters, if you don't want to add them through your SQL. 如果右键单击数据集,然后单击“数据集属性...”,则如果不想通过SQL添加过滤器,则可以在“过滤器”选项卡下应用过滤器。 If there are other columns that tell you whether a user is logged in or not, you can simply tack on more filters. 如果还有其他列告诉您用户是否已登录,则可以添加更多过滤器。 Ex: 例如:

Expression: [Type] Operator: In Value: OperationsLogedIn, FinaceLoggedIn 表达式:[类型]运算符:值:OperationsLogedIn,FinaceLoggedIn

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM