How to passing date parameter using pentaho designer? - mysql

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.

Related

Using a parameter as a filter - Multiple values not working

The report works for just 1 choice, but when I add more than one, it does not return anything ( no errors, just nothing in the report).
My SQL statement includes the parameter #Region
where Region_Name IN (#Region)
In the Region parameter's properties, I set to allow multiple values.
in the dataset filter's properties:
Expression: =Fields!Region.Value
Operator: IN
Value: =Parameters!Region.Value(0)
*EDIT
I removed the dataset filter as suggested.
Below are the properties for the parameter.
The available values come from another data set that is a distinct list of regions.
Your edit makes a lot more sense. To use multivalue parameters you just need to reference the parameter in the usual way, except use in within the SQL:
select cols
from table
where specificcol in #Region
And then don't have a dataset filter set, just make sure there is a reference to the Region parameter in the Parameters property page. The filtering of the data is handled by the inclusion of the parameter in the SQL, so you don't need to also have a filter on the SSRS dataset.
Instead of using a parameter to go back and forth between the stored procedure and the report, I created the parameter and used it in the tablix properties.
Expression: =Fields!Region.Value
Operator: IN
Value: =Parameters!Region.Value
When you first create the value, it adds a (0) to the end of the expression. Remove that and it works as expected.
Thank you #iamdave for the help!
EDIT:
I came back to this and was able to filter using the parameter and stored procedure.
I followed a link from a question to here: http://www.codeulike.com/2012/03/ssrs-multi-value-parameters-with-less.html
I created a dataset parameter and removed the one from the tablix properties. Then created the function provided and it worked. I did not mess with the "ALL" features in the post.
Thanks for all the tips. Brent

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.

Read query string parameter value in SSRS Report

I have passed one parameter to report server url.
http://<your server>/ReportServer?/<folder>/<reportname>&UserID=Name
How can I read UserID value in report.
Or
How can I print this value in any of the textbox to check what is passed to it?
For example: Above url should show 'Name'.
Based on your comments I think you've figured this out already, but all you should need is the parameter UserId to exist on the report and it will get its value from the query string.
A couple other problems that can crop up when trying to pass a parameter:
Report parameters are case sensitive
Report parameters with visibility set to Internal can't be passed a value through URL
See also: Pass a report parameter within a URL on MSDN
You can try with the Built-In SSRS fields ...
Try using Expression -> Built-In-Fields -> UserId should work in this case, if I understood your question correctly...
OR
Try manipulating the report server URL. Provided below one for example ...
=mid(Globals!ReportServerUrl , InStr(Globals!ReportServerUrl,"&UserID=")+8)
Issue was with my parameter UserId.
I have set it as Internal that's why it was set to default value blank space instead of passed parameter UserId value. (Now I am using hidden)
Note: Report parameters are case sensitive so in my case it must be UserId

ssrs parameter values case sensitive

I have a link to a report (SSRS 2008 R2):
http://reportserver/pages/reportviewer.aspx?/folder1/report1&hostname=SERVER2
This report has a (drop-down list) parameter which contains hostnames.
The drop-down list has these entries:
server1
server2
server3
Problem is that sometimes the hostname is passed in uppercase (i.e. SERVER2) and thus the hostname is not selected in the drop-down list does not match the URL parameter. This is because SSRS is case-sensitive with regards to parameter passing.
I do not want the case-sensitivity.
I tried the setting on the Dataset (Dataset Properties - Options - Case sensitivity), but
that did not work.
Is it possible ?
The values in the drop-down box or the URL, I cannot modify.
Best solution would be case-insensitive parameter VALUE passing.
Use the LOWER() function in your SQL or the LCASE() function in SSRS. This function converts the string to all lowercase and if you do it to both sides then effectively case doesn't matter.
So either:
WHERE LOWER(fieldName) = LOWER(#parameter)
or
=LCASE(Fields!fieldName.Value) = LCASE(Parameters!selection.Value)
More info:
LOWER (Transact-SQL)
Useful Built-in functions of SSRS
Update
I slightly misunderstood your question. So you're accessing the report by manually generating the URL with the parameter value in it? This value needs to be passed in a consistent manner or this isn't going to work. SSRS is case sensitive and you can ensure that the available values in the report parameter are formatted consistently using the functions above.
But the generated URL also needs to be consistent. By doing it this way you are explicitly setting the value of the parameter and if it isn't a valid, available value it isn't going to work. The issue here isn't really SSRS it is the fact that the source of the URL does not generate the parameter value in a consistent way.
Fix your URL construction.

The query contains the XXXXXName parameter, which is not declared. SSRS2008/MDX query

Parser: The query contains the XXXXXName parameter, which is not declared. (msmgdsrv)
I have no idea why I keep getting this error. It occurs when I change the MDX in the query designer and trying OKing out of the query designer.
The strange thing is that the parameter DOES exist, I can see it in the parameters section of the dataset dialog. I am creating it before I do anything else with the query.
Although the seemingly intuitive thing to do is add the Parameter in the Dataset Properties window, this actually does not declare the parameter for the query for some odd reason.
To add the parameter, click the Parameters toolbar button in the Query Designer window. From there you can add your parameter names and default values.
Once you've done this, the global parameter list will contain that parameter and allow you to use expressions etc..
Is the parameter defined at the report level? That might be what's missing.