SSRS DataSet Filters
I have a dataset for a report - by default the report shows "all" by using "NULL" as the value in the procedure.
Snippet from SPROC
Where....
ISNULL(r.USER,
'Unknown')
= @USER
OR @USER
IS
NULL)
In the RowGroups where I would like to have my report only dispaly the users toggled by the paramater...I have this expression...
=iif(Fields!USER.Value =Parameters!USER.Value,False,
True)
It is not working!!! can someone help?
KDW
Hi KDW,
Based on my test, I think I have known the issue you are occurring. When you have done all the steps you said, the report only display Null users for USER filed when you select NULL value as the USER parameter value. Have I guessed it right?
When we use the statement “( ISNULL(r.USER, 'Unknown') = @USER OR @USER IS NULL)” in the where clause of dataset query, it already add a filter to the dataset to only display the users toggled by the parameter. And when we select NULL value as the USER parameter
value, it shows all users in the report. We needn’t add the expression to filter again. In the expression, it only show the values when USER
value=@USER value. The NULL value is NULL value, it couldn’t stands for all values. So you should change the Visibility to Show in the Row Groups.
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click here.
Katherine Xiong
TechNet Community Support
Similar Messages
-
Parameter driven query and SSRS Dataset fields
I have a Parameter in my SSRS Report, @PatientSelection. I use this Parameter within my SQL Stored Procedure to execute one version of the report and get specific columns, or another version of the report with different columns.
-- @PatientSelection is set to 1 if the Business Report Requestor chooses "New Patients"
IF @PatientSelection = 1...
-- @PatientSelection is set to 2 if the Business Report Requestor chooses "Established Patients"
IF @PatientSelection = 2
When I do this, none of my fields are showing up within my SSRS Dataset.
Am I fundamentally doing this the wrong way concerning SSRS and Report Creation???
Any feedback is greatly appreciated. Thanks for your review and am hopeful for a response.
PSULionRPYou can add manually the missing fields, drag and drop all needed fields to the tablix and see how was it going. Doo you use one or two tables(based on the parameters) to display the report?
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
SSRS dataset filter expression using OR
I have a dataset that I need to set a filter for. What I need the filter to do is check 3 different fields to see if either one of them are in a parameter. The parameter is multi-value. So, I have a parameter set to 1, 2, 3. I need the dataset to return
records where either Field A, B, or C are IN 1, 2, 3.
Anyone know how to do this? I tried to have the filter expression = Fields!A.Value or Fields!B.Value or Fields!C.Value then the dataset filter operator "IN" and the dataset filter value = Parameter, but I just get an error on the dataset filter
(cannot evaluate filter expression error)Hello,
Mulitple expressions added to SSRS dataset filter are evaluated as AND (Expr1 AND Expr1 AND Expr3). If you are looking for a OR like Expr1 Or Expr2 Or Expr3 then you can use this solution explained below.
Dataset Query used for this test:
select *
from (values ('Row1',1,1,4),('Row2',2,1,3),('Row3',3,1,2),('Row4',3,2,2),('Row5',5,3,2),('Row6',5,6,7),('Row7',2,6,7)) x(DataRow,A,B,C)
Report Parameter :
Defined a multi select report parameter named "Parameter1" with string datatype and added values 1, 2, 3.
Dataset Filter Expression:
=Filter(Parameters!Parameter1.Value,CStr(Fields!A.Value)).Length + Filter(Parameters!Parameter1.Value,CStr(Fields!B.Value)).Length + Filter(Parameters!Parameter1.Value,CStr(Fields!C.Value)).Length
The expression above uses the Filter function in SSRS to check if the field A\B\C has any match in the parameter1 mutli select parameter. If yes the length property will return a value > 0. Repeat the expression for all the other fields and add the Values
for length property.
Use > operator in the filter dialogue box
and value as 0 as shown in the snapshot below.
The output is shown below. Row 6 is missing as Field A, B or C doesnt have 1, 2,3 as values. If this is the output you are looking for this solution should work for you.
--sIbu -
I have a work to do, in ssrs we are using server reports in our project. i am looking for dynamically generating the ssrs dataset and filling the data into the dataset and binding the dataset to ssrs report(RDL) dynamically.
Getting the dataset dynamically has a solution by using Report Definition Customization Extension (RDCE), but the problem is binding that dataset to the report(RDL) dynamically was not there.
Here is the reference for RDCE http://www.codeproject.com/Articles/355461/Dynamically-Pointing-to-Shared-Data-Sources-on-SQL#6
I looked for binding the dataset to the report(RDL) dynamically and searched many sites but i did not get the solution. Can anyone help me here.
Is there any custom assemblies or any Custom data processing extensions to work around. Please help.
Thanks in advanceHi Prabha2233,
Thank you for your question.
I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.
Thank you for your understanding and support.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
Filtering SSRS dataset on parameter INT
Hi.
I have a simple report which has a Week parameter.
Week is a multi select parameter populated from a dataset (values 1-52).
I have now added a filter to the main dataset:
Expression: [Week]
Operator: In
Value: Split(Fields!Week.Value, ",")
I get an error as soon as I try running the report with this filter:
An error has occurred during report processing. (rsProcessingAborted)
The processing of FilterExpression for the dataset ‘ProjectTimesheetDataSet’ cannot be performed. Cannot compare data of types System.Int32 and System.String. Please check the data type returned by the FilterExpression. (rsComparisonTypeError)
I have tried wrapping the the expression and Value with Cint, no joy.
If I write out the value of Week to the page using the Join funtoin I get resutls i.e. 48,49,50
Where am I going wrong??Hi CDG100,
Based on my research, I think this issue is caused by the data type mismatch between Week field and parameter WeekNumber. If I understand correctly, the Week field is Integer data type in your dataset, while the parameter WeekNumber is Text (String) data
type. In your scenario, even we change the field to Integer (from Text), it will also turn back to Text. Because the filter always change the data type of Expression to match the Value data type. That’s the reason why the error message that “Cannot compare
data of types System.Int32 and System.String” appears.
So in order to fix the issue, please try to use an Integer data type field as the parameter values by using Get values from a query. Then the Week field and parameter WeekNumber can be compared.
If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
SSRS Dataset Filter expression query
I have an SSRS report which has a simple dataset and accepts two date parameters, and filters the results based on a Position parameter. The Position parameter filter is:
Expression: Position
Operator: In
Value: [@Position]
I have now been told that each position has a few other aliases in the database against the Position column. i.e. For a Position of "Contractor" I now also need to return "Consultant" records, based on the same field. Note, only one Position
can be selected at a time.
I imagine I have to update the Value expression above to do something like:
- When @Position in "Contractor" also return rows where Position is x, y, z (I am happy to hard code these)
I have about 10 Positions each with one or more aliases - can someone help guide me on how to set up the expression?
Thanks!Thanks Ione.
Ok - I have set my parameter values in the value box, comma separated
My dataset filter for the param Operator is set to IN and the value [@Position]
However where I have multiple values set against a position I do not get any results (there is data in the DB)
Do I need to do something different when setting the paramter values? i.e. use the expression and then a function to parse the comman separted values
Or - something in the Filter to make the expression parse the incoming paramter?
Thanks again -
Unable to execute Web Service from SSRS Dataset
Hi,
I am unable to access a Web Service to execute Dataset from MS SSRS. I have created a Dataset that refers to a WebService as a Query. The dataset and Query runs well in DEV environment. However, the following error message is displayed when executing
the Query inQA environment:
An error occurred while executing the query.
Failed to execute web request for the specified URL.
Soap Fault:
The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior)
on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs. (Microsoft SQL Server Report Designer)
rogram Location:
Server stack trace:
at Microsoft.ReportingServices.DataExtensions.XmlDP.InMemoryCommand.ExecuteWebRequest(ICredentials credentials)
at Microsoft.ReportingServices.DataExtensions.XmlDP.InMemoryCommand.Execute()
at Microsoft.ReportingServices.DataExtensions.XmlDP.InMemoryCommand.<>c__DisplayClass1.<ExecuteReader>b__0()
at Microsoft.ReportingServices.DataExtensions.XmlDP.WebRequestHelper.ExecuteServerCallAsNtUser(ServerCall serverCall, WindowsIdentity ntUser)
at Microsoft.ReportingServices.DataExtensions.XmlDP.InMemoryCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.ReportingServices.QueryDesigners.MultiThreadedQueryResultsHelper.AsyncExecuteReader(IDbCommand command, CommandBehavior behaviour)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
at Microsoft.ReportingServices.QueryDesigners.MultiThreadedQueryResultsHelper.ExecuteReaderHandler.EndInvoke(IAsyncResult result)
at Microsoft.ReportingServices.QueryDesigners.MultiThreadedQueryResultsHelper.<>c__DisplayClass1.<ExecuteActiveQueryCallback>b__0()
at Microsoft.ReportingServices.QueryDesigners.QueryResultsGrid.EndExecuteReaderInUiThread(GetDataReaderHandler getDataReaderCallback)
===================================
The remote server returned an error: (500) Internal Server Error.
<s:Envelope xmlns:s="<faultcode">http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="a:InternalServiceFault</faultcode><faultstring">http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode><faultstring
xml:lang="en-US">The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug>
configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.</faultstring></s:Fault></s:Body></s:Envelope>
I am looking for a solution to this problem. Any help in this regard will be appreciated.Hi Abhijit PS,
According to your description, when calling a web service on production environment, you get the above error message. Right?
In this scenario, it seems you are calling WCF services. Since it's an internal error, we suggest you enable the IncludeExceptionDetailInFaults to see the detail information about the error. Please refer to the articles below:
How to enable WCF tracing
Turn on IncludeExceptionDetailInFaults while connecting to a WCF service from a
client.
The server was unable to process the request due to an
internal error. For more information.. Turn on IncludeExceptionDetailInFaults
Also please refer to some similar threads below:
Turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration
behavior) on the server
WCF Error The server
was unable to process the request due to an internal error
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
SSRS Dataset Column MetaData dynamic Update
Hi All,
I have report which is dynamically pivoting columns in the query ,i need to update those dynamic columns on the ssrs column metadata fields on the data set,cross tabbing using tablix doesn't work for my logic ,is
there any way ,the column names can be updated when new columns get added .
As an example
If my dataset query is dynamically pivoting sales data against months when month changes, i need the new month to be update in the data set fields
Region1 Product1 Sept Oct
Region1 Product2 Sep Oct Nov
Many Thanks
ChandraHi DataPro2010,
According to your description that you have columns(Month) which need to update in the DB sometime, so this fields need to update in the report too, you try to use pivot function in the query to make them update dynamically on the report but failed, right?
I have tested on my local environment and we can make it dynamic increase by using the matrix, you have mentioned matrix not support the logic, I think you problem can be caused by the wrong way you design the matrix, you can use the unpivot function to
turn the column name of month to a single row and create an matrix to put the month name in the column group ,Details information for your reference:
1. Put the query below to the dataset:
SELECT Region, Product, Col , Amount
FROM
select Region, Product,Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,….Coln from case1111
)a
UNPIVOT(Amount FOR Col IN (Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,..Coln) ) p
Note: Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,….Coln :this part need to update every time you have added an column of month in the DB.
2. Create an matrix and design the report as below
If you have some other fields which will not dynamic increase, you can insert these fields the same way as [Product] (Product is added as the inside group of Region,[Col] will display the month name)
3. Every time you have added an column in the DB, remember to update the query by adding this column in the step1 too, and then the matrix will be update automatically.
There is also another method to design the column (Not using the Matrix)by using the parameter to control the dynamical increase for your reference:
http://www.codeproject.com/Articles/11254/SQL-Reporting-Services-with-Dynamic-Column-Reports
Any problem, please feel free to ask
Regards
Vicky Liu -
Hi --
I have a Dataset which returns data based on a multi select parameter. It uses a filter to achieve this and works as expected (based on the IN Operator).
Now I have to update the report so it also returns records for this parameter value which are NULL - Is it possible to achieve this using an expression/filter within the report, or do I have to get the DBA's to review and update the back-end stored
procs?
ThanksThanks Visakh16 -- Sorry, but to add to this..
I need to allow the user the option to include blank values, or not. Therefore I have added a new parameter "also include blank projects", a yes/no drop down.
I currently bring back the complete dataset, which is then filtered by the multi select projects param - but how do I get the new parameter ("include blank records") to bring back the selected projects AND records where the Projects field is NULL
if the new param is equal to Yes? -
SSRS – Parameters filtering – getting data from SSAS
Dear all
I am working with SQL Server 2012, SSRS Report Builder, SSAS.
I created a new report with 2 Parameters from my SSAS.
First Parameter is Year.
Second Parameter is Month.
What I want to do is that when I select specific year it automatically filter all the month inside the second parameter.
Here is an example:
Year
Month
2012
January
2012
February
2012
March
2013
May
2014
Jan
How can I achieve this?
Thanks,
Ramzy N.Ebeidyou need to create cascade parameter
in SSRS report (parameter month will be calculated by filtering based on parameter @Year selection)
You may need to write mdx query as an expression something like below as data set for month parameter.
select [Measures].Months on 0,
Filter(Time.[Year].members,
Time.[Year].CurrentMember.Name =
@Year) on 1
from [Cubename]
Gaur -
SSRS dataset throws error when another stored procedure is called inside dataset stored procedure
Hello;
I am using Report Build 3.0, I have a simple report which gets data using dataset which is created from a Stored Procedure. I have another stored procedure which updates the data in the table which is used for the report. I want to get the live data on report everytime
the report is run so that I call that stored procedure (sp_updatedata) inside my report dataset stored procedure and here where my report fails as it throws error while creating dataset.
Here is sample:
sp_updatedata (this only returns "Command(s) completed successfully"
Create Proce sp_getReportData
As
Begin
Exec sp_updatedata -- I call it to update the data before it displays on the report
Select * from customers
End
If I remove this line it works.
Exec sp_updatedata -- I call it to update the data before it displays on the report
Thanks
Essa MughalHi MESSA,
According to your description, you create a dataset based on a stored procedure. In this procedure, it calls another procedure. Now it throws error when creating dataset. Right?
In Reporting Services, when creating dataset, all the query or stored procedure will be executed in SSMS. So if the procedure can be executed in SSMS, it supposed to be working in SSRS. However, it has a limitation in SSRS. In a dataset, it can only return
one result set.
In this scenario, I don't think it's the issue of calling other procedure inside of procedure. Because we tested in our local environment, it works fine. I guess the sp_updatedata returns a result set, and the "select * from customers" returns
another result set. This might be the reason cause the error.
Reference:
Query Design Tools in Report Designer SQL Server Data Tools (SSRS)
Reporting Services Query Designers
If you still have any question, please post the error message and the store procedure (sp_updatedata).
Best Regards,
Simon Hou -
Hi all, I'm trying to create multiple non-destructive filters
on a Spry XML
Dataset,
however it seems that when passing a filterfunction that's
part of an
object,
the function (SpryFilter.filter) can't reference the object's
properties,
this is remedied by calling the object's filter function from
an anonymous
method, but how do I remove the anonymous method from the
flters?
function SpryFilter(filterName, filterValue)
this.filterName = filterName;
this.filterValue = filterValue;
SpryFilter.prototype.filter = function(dataSet, row,
rowNumber)
if ((this.filterName)?
row.category.indexOf(this.filterName+":
"+this.filterValue) !=
-1|row.category.indexOf(this.filterName+": ")==-1 :
true)
return row; // Return the row to keep it in the data set.
return null; // Return null to remove the row from the data
set.
function SpryFilterManager()
this.filters = new Array();
var fmgr=new SpryFilterManager();
SpryFilterManager.prototype.addFilter = function(dataSet,
filterName,
filterValue, apply)
this.filters[filterName]=new SpryFilter(filterName,
filterValue);
// define anonymous function that calls the filter object's
function
var f = function(dataSet, row, rowNumber){return
fmgr.filters[filterName].filter(dataSet, row, rowNumber);};
// pass anonymous function to dataset
dataSet.addFilter(f, apply);
SpryFilterManager.prototype.removeFilter = function(dataSet,
filterName,
apply)
if(this.filters[filterName])
//define same anonymous function as above
var f = function(dataSet, row, rowNumber){return
fmgr.filters[filterName].filter(dataSet, row, rowNumber);};
// FIXME: this does not remove the other
anonymous function
dataSet.removeFilter(f, apply);Nevermind I found a solution.
By storing a reference to the executive function in the
filter object, that
reference can be passed to SpryDataSet.removeFilter() -
SSRS filter a dataset if parameter is "Yes"
hello i have a report as below
with date Parameters this all works fine!
date from date too
01/01/2011 21/02/2013
name amount date
test1 100
01/01/2012
test2 200 01/02/2013
but what i want is to have another parameter which says something like yes or no and a filter on the data set which responds to the parameter
so that if the parameter = "yes" then filter the data set so as "not" too include test1 as a company but if "NO" then include all records!
Steve masonAdd new parameter in SSRS report and pass it down to query .
In the query add a filter like below
WHERE....
AND (name <> 'test1' OR @NewParameter = 'No')
or if you want to do this in SSRS dataset do like below
=IIF(Parameters!NewParameter.Value="Yes",Fields!Name.Value,0) for Expression
<> for operator
and
=IIF(Parameters!NewParameter.Value="Yes","test1",1) for Value
in dataset filter tab as per below
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
SSRS parameter date/time properties
Hello,
I wanted to see if someone could help me with a SSRS parameter issue.
I’m using parameters to create user defined @BeginDate and @EndDate for the report.
I’m formatting the parameter properties as a Date/Time format to get calendar controls in the report.
The problem I’m having is the ‘date field’ in underlying data set is formatted as (char(8), not null).
I believe this is causing problems with the Date/Time format in SSRS parameter properties.
The data field would look like this 20500401.
Is there any way that someone could show me how to format my @BeginDate and @EndDate in my dataset query to work with the SSRS parameter properties Date/Time format?
Any information would be greatly appreciated.
xHi Tracy,
The dates aren't field that are in my SSRS dataset. They filters in query though
Originally my query was before I added parameters:
...Where TRANS_DATE between '20140101' and '20140331'
After adding parameters:
....Where TRANS_DATE between @BeginDate and @EndDate
Is there anyway that I could convert the TRANS_DATE field in my dataset query to work with SSRS Date/Time format instead?
If I was returning the TRANS_DATE field in my dataset I think I could use your expression in the filter.
Thanks,
x -
Can I create a result set filter on a SSRS Report similar to what you can do in Excel?
Asking this question in a different way...I have my SSRS Result set. Now the Business User wants to filter down a 15-page report to what they want to specifically see....Sooo my result set has a list of claims. And now the Business User just wants to see
the list of claims by a certain Provider, which is also in the report. So I don't want to put that "filter" on the front-end...within the Stored Procedure that is producing the report because they want to see everything. Is there a way to make SSRS
intelligent enough to parameterize the back-end result set? Or do I need to do it the old fashioned way by allowing for an optional parameter, let them run their report, define the available values by a query similar to the stored procedure filtering, and
let them drill down that way?
I have tried playing around with Dataset filters and a parameter using the existing result set and existing Dataset, but I just cannot seem to get this to work the way I envision. If this entails creating a Function or Procedure within the SSRS, bring it
on...I'm willing to learn. And I do have some VBA experience...so I'm not intimidated.
Again...I apologize for the similar type question, but I felt the need to be a little more clear.
Thanks for your review and am hopeful for a reply.
PSULionRP
I GOT IT!!!
Followed the following...
Here's what I've put into my SSRS Knowledgebase...
Filters/Parameters on the Report Result Set
Request from the Business User to add "parameters" to the Report Result Set. Kind of like auto filtering you can do in Excel
Within the Report Design within Microsoft Visual Studio…
— Insert a new Dataset which is merely carving out the SQL from the working Report Stored Procedure and customizing the SQL for the DISTINCT values that you want
— Insert a NEW Parameter based on the carved out SQL
General → Allow blank value
Allow multiple values
Available Values → Get values from a query
Specify the previously created Dataset
Default Values → Get values from a query
Specify the previously created Dataset
— Insert a Filter back on the original Dataset that is used to create the Report
Expression → Choose the Report Detail Item column name
Operator → In
Value → Physically type in the Parameter Name created previously
Works EXACTLY as I had envisioned. Prompts for the From Date and Thru Date, runs the report, dynamically builds the "optional" parameters/filters,
and then allows the Busimess User to speify or drill down into the result set based on the dynamically built parameter drop-down list.
Maybe you are looking for
-
Creating a new OAF page in iProcurement
All, I have a requirement to create a new page. Please let me know how to proceed with this as soon as possible. Thanks
-
Issues monitoring the 2602i Cisco AP with Zabbix.
Hi! My workplace just bought a lot of Cisco AP (2602i) and a WLC 2500 and I'm in deep trouble trying to monitor them with Zabbix, wich is the SW we use for our whole Network. After a lot of time I got to monitor the CPU use (in %), traffic of each in
-
Dear all, i am facing a problem in sales order. i explain the process, if i am creating sales order with reference to quotation will take all item from quotation. there is one condition in pricing procedure ZFR1(excise factor) on this price we calcul
-
Can't connect to MSSQL database
Hi, I'm very new to J2EE. I've been trying to get my JSPs to access my MSSQL database. I'm using JBoss as the application server. Here's what I've done: 1. Downloaded and installed the MSSQL 2000 JDBC driver. 2. Edited the \server\default\deploy\mssq
-
I've even reset my computer a few times and no go. Where could my editing windows be hiding?