SSS Report Builder 3.0 Query Parameter - Report Preview - mysql

This is a bit strange to me. I am using a SSRS Report Builder 3.0 for creating a report. I have two options: 1. Use a filter linked with report parameter OR 2. Use a query parameter linked with report parameter.
In the first case, the report preview works perfect. I am using a simple query for filter with parameter (#parameter_a) applied on ID column:
Select ID, Name from tbl_Table
But when I use a query parameter linked to the report parameter, the preview is blank. For the query parameter, I use the below query:
SELECT ID, Name FROM tbl_Table WHERE ID = #parameter_a
I am clueless on this. I have also tried keeping a default value or removing it. Refresh/View Report doesn't work either.
PS: I am using MySql ODBC connection. Both options in report work fine when used in a c# application and rendered programatically. Tried re-installing current version, older version as well.

Reading the MySQLCommand documentation, there is reference to an older parameter syntax (not sure what version of MySQL you are using in this scenario).
Using the '#' symbol for paramters is now the preferred approach
although the old pattern of using '?' is still supported. Please be
aware though that using '#' can cause conflicts when user variables
are also used. To help with this situation please see the
documentation on the 'allow user variables' connection string option.
The 'old syntax' connection string option has now been deprecated.
Instead of using #, can you try with ?:
SELECT ID, Name FROM tbl_Table WHERE ID = ?
The order of the parameters used in the query will have to match the order of the SSRS report parameters.

Related

MySQL + SSRS (SQL Server Report Builder) Dataset/Query Parameters not working

I am currently using SQL Server Report Builder 2012 and is connected to my MySQL Database via an ODBC Connector and as far as base report goes, all is well.
However, i can't seem to make the Query/Dataset Parameters to work the way its supposed to be. I have multiple parameters to my query as you can see below (obviously table and column names are removed):
Now the problem is, if i leave the parameters as is (#OfMonth, #OfDay, #OfYear) - SSRS does not seem to bind the actual values passed from the Report Builder's Parameter Object which i am confident to day that i have associated properly. Not even on the preview/query designer.
However, if i change all #XXXX parameters to simple ? placeholders, it magically works. This poses as issue specially with queries that have multiple parameters.
This is the Report Builder's screenshot of my Work in Progress:
i have no issues defining the 3 Parameter object under the Parameter Node. However, if i try to bind them under Dataset Properties with specific #XXXXX placeholders, it doesn't work, and the report fails to generate data. But if i replace all #XXXXX with ? (all of them are just ?, therefore duplicates), the parameter gets passed and the report loads.
For ODBC connections, you do need to use a ? instead of named variables.
dba.stackexchange | Pass Parameter - SSRS to MySQL
The Parameter Name field on the Dataset Properties should auto-fill with Parameter1, Parameter2,... to match your query but doesn't always seem to work. You can try adding them manually. Since it worked without the name for you, I assume the name doesn't actually matter.
When I would have a parameter used multiple times, I would declare a new one in the query and reuse the new one as #Bacon mentioned:
DECLARE #OfMonth INT
SET #OfMonth = ?
This way you only have to match them once at the beginning of your query.
Use ? as variable in your script, then remember specific order of '?' then using specific order/arrangement of '?' parameters, setup them in the parameter tab after you add the MySQL script.
Ex. Script.
Select * from table1
where column1 = ?
and column2 = ?
When you paste this on the dataset, each '?' will be mapped in the parameter tab.
? Parameter1
? Parameter2
Change this to your own parameters then you're good to go.

Getting a "one or more parameters required to run the report have not been specified" error

I am building a report that I would like to accept two values from the user, feed those into a query, and find the data associated with those entries.
For example, if you had a list of employees, performance measures, and values associated with those; then the user would select an employee name / performance measure, and they would get the scoring information on that employee for that measure.
I have two parameters, each being populated from SQL queries getting a distinct list of employee names and measures, and a table below that just pulls up information based on ~ 'WHERE name = #Name AND measure = #Measure' but when I click 'Preview' to run the report locally I get the error: "one or more parameters required to run the report have not been specified"
I know the parameters are working properly because I can feed their values directly into a textbox and the values populate correctly. Also, if I change the query to just accept one parameter (i.e. WHERE measure = #Measure) the query works.
I'm confused as to why this error is occurring since I know my parameters are functioning and being populated properly.
I experienced this behavior in .NET 4.0 using Local Reports (in .rdlc files), when one of the parameter's values was containing an emtpy string. Although setting the parameter was correct:
report.SetParameters(
new List<ReportParameter> {
new ReportParameter("Title", Messages.Title),
new ReportParameter("SubTitle", Messages.Subtitle))
}
);
It worked only as long as both parameters actually contained some characters, otherwise the mentioned exception was thrown.
This error is caused when you either
A) the parameter is spelled wrong in the actual report. Meaning that the query is expecting #Name but the report is passing #Names (or some other spelling).
or
B) Is it possible you are attempting to run the report with a default value on the parameter of NULL for #Name but the stored procedure requires an actual value?
This might be happening if you are building the report in Visual Studio and gave the #Name parameter a default value of (null).
Try removing the default value or making sure you #Name parameter has an actual value, even if it's just ''.
I had similar issue. Issue happened when you use SharedDataSource with parameters that are to have null value. If you use same query in embeded data source, there is no problem.
Unlike embebed data source, you have to define if parameters used in query of shared data sources are allowed to have null value as highlighted in screenshot here. In my case, there are two parameters in query of shared data source, that can have null value.
So after setting them to allow null, problem fixed!
This caused me many hours of pain. Turns out that it's to do with using a shared dataset.
Embed the dataset within your report instead and it works fine.
For me, setting the value of the parameter makes problem. I don't know why, but the parameter value was not able to accept a string.Empty or null. So i just gave a " " as value solves the error.
Sample
ReportParameter[] parameters = new ReportParameter[4];
parameters[0] = new ReportParameter("Name", EName);
parameters[1] = new ReportParameter("ShiftName", CurrentShift);
parameters[2] = new ReportParameter("Date", LoginDate);
if(ValidateReportData())//some condition
{
parameters[3] = new ReportParameter("Date1", LoginDate);
}
else
{
//parameters[3] = new ReportParameter("Date1", string.Empty);//this makes exception while calling Render function.
parameters[3] = new ReportParameter("Date1", " ");//Solves the issue.
}
I was having the same problem, it is now sorted on sql server 2008 r2.
I know this is now an old question,
but just to help others:
It was very simple really, just making sure the spelling including the case is the same and the use of #.
I have a shared dataset called currentSpaceByDrive with the following code:
SELECT
[DRIVE]
,[Volume_Size_GB]
,[VolumeSpaceAvailable_GB]
,[VolumePercentAvailable]
FROM monitoring.dbo.currentSpaceByDrive(#ServerID)
I add the shared dataset currentSpaceByDrive to my report and I give it the same name.
when I right click on it, the one on my report, dataset properties, the parameter is #ServerID.
#ServerID value comes from another dataset, called the_servers (where the user selects a serverID)
I have a report parameter also called #ServerID that gets its value from the_servers and is used to feed the #ServerID parameter on currentSpaceByDrive.
Too many #ServerID, I understand, but if you do your own test based on this, you will get it done.
See the image attached.
hope this helps
marcelo
check DataSet In Report Server , I had Similar Problem , I was Editing Shared Dataset in Visual Studio , but it didn't work , after an hour of frustration I checked dataset in report server and I found out it Is not updating with changes I made in visual studio , I Delete it and Redeploy Dataset Again from visual studio . it works .
Actually I had to:
Delete the SubReport object from the report.
Drag new object from Toolbox
Setup the SubReport name and report
In Paramateres "Add", and choose each parameter, and related value.
Then is works for me.
I think I have same issue my Parameter Supervisor is blank when I choose "Select All" which causes the error "One or more parameters were not specified for the subreport", but if I select a few supervisor name then the sub-report appears. It is puzzling because the Manager parameter value shows all value when "Select All" is checked, but it is not working on my Supervisor parameter. Note that Supervisor parameter is dependent on manager parameter.
I'm using shared DataSets for several reports, and the root cause of this issue was not mapping the input parameters from the report itself to the parameters of the shared dataset.
To fix, I navigated to the "Report Data" panel, opened the dataset (which is really linking to a shared dataset), clicked the "Parameter" tab, and then mapped the report parameters to the parameters of the shared dataset.

How to passing date parameter using pentaho designer?

I have problem how to passing parameter date field database in report.
I have set the parameter like this :- X.createDate= ${datetim} in MySql.
I have also put the parameter setting in pentaho designer. When i run the report. the result not appear.
Below is Screenshot for parameter setting in report:-
Anybody know about this?.
You set a query on the parameter. If a parameter has a query, the query's results will be used as validation source. Any provided parameter value will be checked and only accepted if it is found in that result-set.
First: Mark the parameter as mandatory, so that you get informed if the reporting engine considers your parameter invalid.
Second: the date-picker does not actually indicate which values are valid or not. So if you indeed only want to select parameters based on the available dates in the database, I would recommend to NOT use the date-picker. Use a drop-down menu instead.

rs report design parametrized query for MySQL

I have a Mysql DB report with visual studio report server and is displaying correctly in report server.
but i want to do a parametrized query and after reading and searching i know the obdc driver cant pass # and i have to use '?' but after trying a lot i cant figured out how to implemented.
I have a #parameter which use a secodn dataset that query the db for usernames
i have my main dataset with the where (user = '?') and in the dataset parameter tab i try putting an expression with the select query for user and try use the actual parameter.
am a little lost here.
got it in my case..., use
where (usernames = ?)
in the query and in the parameters tab of the dataset use Parameter1 as name and in value match it with the created parameter in Parameters

DataSet query with Parameters does not work in Report Builder

The following picture shows the query and its result with no variables:
The next one shows the same query with a variable and a different result:
This how the parameter was set just before the query execution:
I have also tried setting the parameter without '' but it produces the same result.
Any clue about what's going on? Any help would be greatly appreciated.
NOTE: The DBMS is MySql
This weird issue is due to the fact that SSRS is connected to MySQL by ODBC connector; therefore, the query parameters should be defined as ? and their names are Parameter1, Parameter2, etc... in order of appearance
Source: http://www.tek-tips.com/viewthread.cfm?qid=1354185
In Report Builder 3.0 you can user parameters in a dataset query using the following syntax:
WHERE sql_column_name = (#Parameter_name_in_ReportBuilder)
Example:
SELECT * from [dbName].[dbo].[TableName]
WHERE Account=(#Parameter1)
Before you can run the report, you need to configure a paramter named Parameter1 (in this example, change this to the name of your parameter) in Dataset Properties - Parameters. The value field should be set to one of the parameters