SSRS Model query - how to pass in a parameter? - reporting-services

I have a report based on Report Model and for creating dataset I use the query designer (as there is no real other way). However I am struggling with how to pass a report parameter to the query to use it as a filter. Anything starting with # is considered as a syntax error...
Is there a way?
Thank you in advance.

The trick is in the Filter definition to specify the property as a 'prompt'. This will eventually create a parameter for which you then can map the value from the report parameters.

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

SSRS parameter with #

How I can pass SSRS parameter with #? When I am trying to choose email from parameter list, I get:
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'DataSet1'. (rsErrorExecutingCommand)
Parser: The syntax for '#xx' is incorrect. (ASF#xx.com).
I need it to filter my MDX dataset.
The values in cubes uses are not simply text, they are members of a dimension with attributes. In order to make the comparison, it needs to be converted to the proper syntax. A good way to add a parameter is to use the SSRS Query Designer.
Go to your Dataset properties.
Click on Query Designer.
Drag the attribute to the top-right corner.
Check the box in the Parameters column.
Click OK.
This will create a hidden dataset along with the parameter. It also formats the dropdown list for you.
If you look in the MDX it creates, there is a StrToSet function that it uses to interpret the string.
Another option that is simpler, but less efficient is to simply apply the filter to your dataset within SSRS.
Go to the Dataset properties.
Go to the Filters tab.
Add a filter that ensures the Email column equals your Parameters!Email.Value

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.

Reporting Services problem. Forward dependencies are not valid

I have a problem with a Reporting Services report. My report has two datasets, one that fetches the actual report data and one that fetches translated resource strings for displaying wherever literal text is used on the report. This dataset requires three parameters, a language set id, a language code and a string to match against resource names.
Following an example I found here (the reply by Miguel Catalão) I have created a multivalue parameter #Resources that will be populated from the resource dataset and a code function that looks up specific values from the multivalue query. This function will then be called from expressions wherever literal strings are used.
I think that this should work but I have run into a problem that I can't quite figure out a workaround for. There is a dependency problem in the #Resources parameter being dependent on the Resources dataset which in turn is dependent on three parameters; #LanguageSetID, #LanguageCode and #ResourceNameLookup. I have read that the order of declaring parameters is important so I have made sure that the last three parameters appear above the #Resources one and that all three of them have default values that will result in data being retrieved by the dataset.
Yet I am still getting the following errors when previewing the report; any advice or guidance would be most appreciated.
The report parameter ‘Resources’ has a DefaultValue or a ValidValue that depends on the report parameter “LanguageCode”. Forward dependencies are not valid.
The report parameter ‘Resources’ has a DefaultValue or a ValidValue that depends on the report parameter “ResourceNameLookup”. Forward dependencies are not valid.
I had the same error but it was due to something else. What I had done was created a Parameter in my report, then linked the Default Values to a Dataset.
This in turn added the parameters needed in the Dataset. Somehow, the order of the parameters in my list were changed. This is when I stared getting the 'Forward Dependencies are not Valid' error.
I then looked at another report that used the same process to link a Parameter to a Dataset. I noticed that the order of my Parameters were different. I simply went back to my new report, and used the up and down arrows until my Parameters were in the same order as the working report. This seemed to fix the error and work fine. Apparently the the Parameter that was using the Dataset needs to be below the Parameters that are used in the SPROC.
I this helps someone in the long run.
C/N: Parameter was being filled by a Dataset(Stored Procedure). The Parameter that was being filled was above some of the Parameters that it was expecting for the SPROC.
This was all caused by a stupid error I made. I copied and modified the code function from the post I mention but neglected to change the data type of the argument from integer to string, which mine is.
It seems rather odd that the error manifested in the way it did but I have gotten past that problem now, only to run into another that I ask about in another question.

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.