简体   繁体   English

是否需要在SSRS中编写表达式,该表达式需要根据应用的条件过滤我的记录?

[英]Need to write expression in SSRS which need to filter my record based on the condition applied?

  1. I have a column called Booking in my data set. 我的数据集中有一个名为Booking的列。
  2. What I need is i need to filter booking start with TR-AFP alone from my BOOKING column. 我需要的是,我需要从“ BOOKING列中过滤仅从TR-AFP开始的BOOKING
  3. So I need a parameter which need to have like this (TR-AFP AND ALL) when user select anyone it should show as per their condition. 因此,当用户选择根据其条件应显示的任何人时,我需要一个具有这样的参数(TR-AFP和ALL)。
  4. Like if I select TR-AFP it should show only TR-AFP records in ssrs report, if i select all it should show all records except TR-AFP or including them. 就像我选择TR-AFP一样,它应该仅在ssrs报表中显示TR-AFP记录;如果我选择全部,它应该显示除TR-AFP或包括它们之外的所有记录。

This is my Temporay data for your use case 这是我的Temporay数据供您使用

在此处输入图片说明

create parameter as below 创建如下参数

在此处输入图片说明

Now create row visibility expression as below 现在创建如下行可见性表达式

在此处输入图片说明

Note just for simplicity purpose I have made condition as if user selects TR-AFP then show records with only Category="electronics" and if user selects "ALL" then everything except category="electronics" 请注意,仅为了简单起见,我已经做出了这样的条件:用户选择TR-AFP然后显示仅带有Category =“ electronics”的记录,如果用户选择“ ALL”,则除category =“ electronics”之外的所有内容

You just have to adjust according to your column and it's Value 您只需要根据您的专栏进行调整即可,它的价值在于

=IIF(Parameters!ReportParameter1.Value=1 and Fields!category.Value<>"electronics",true,
IIF(Parameters!ReportParameter1.Value<>1 and Fields!category.Value="electronics",true,false))

Here is how it looks, Look for Right hand side, left hand one is just for your ref as database 这是它的外观,查找右侧,左侧仅是供您参考的数据库

在此处输入图片说明

在此处输入图片说明

You can try making a separate dataset just for the distinct booking entities. 您可以尝试仅针对不同的预订实体制作单独的数据集。 Declare that parameter in your original dataset, create temp table, join that temp table to the original table. 在原始数据集中声明该参数,创建临时表,然后将该临时表连接到原始表。 Hope this works for you 希望这对你有用

@booking Temp table SELECT CAST(VALUE AS VARCHAR) AS Booking --INTO #booking --FROM string_split(@booking,',') @booking临时表SELECT CAST(VALUE AS VARCHAR)AS预订--INTO #booking --FROM string_split(@booking,',')

select ....... from...... JOIN #booking B on originalDS.booking=B.booking 选择.......从......在原始DS.booking = B.booking上加入#booking B

in SSRS 在SSRS中

Original DS > Parameters > Expression > =Join(Parameters!booking.Value,",") 原始DS>参数>表达式> = Join(Parameters!booking.Value,“,”)

Regards, 问候,

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

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