disable/disregard a second parameter based on the first parameter - ssrs-2008

I have 2 multi-value parameters in my report. When we generate the report using only one of them a problem arises. If I select a value for parameter 1 and keep parameter 2 unselected I get an error:
Please select a value for the parameter Param2
This happens even if I check "allow blank value" in the parameter's properties.
In addition: is there a way to make a set a parameter to be enabled/disabled based on a another parameter's value? For example:
if I create another parameter having values Param1, Param2;
if I select a value for Param1 the report will be generated based only on values selected in Param1, disabling or disregarding Param2

The short answer is no.
My workaround for this scenario is to fiddle with the Dataset driving the Available Values list for Param2. You need to set it up so that when the particular Param1 value is selected, the only row that will match will be a dummy row (e.g. 'N/A'). This might involve a UNION ALL to generate that dummy row.
I use the same dataset for Default Values so that the dummy row will be automatically selected when the Param1 value is selected.
You then need to cater to that dummy Param2 value in the other datasets that refer to Param2, e.g. SELECT ... WHERE ( #Param2 = 'N/A' OR Column2 = #Param2 ).

Related

Multiple Parameters in crystal report

I have created a crystal report layout with 3 parameter.
The 3 parameters are
1.) Date range
2.) Supplier
3.) Location code
User will always give input to the date range but will select either of these remaining two parameters based on the usage.
Is it possible to configure in one single report with optional option in Crystal layout
Assuming you are not using a very old version of Crystal, when you create or edit a parameter, look at the list of parameter properties: one of them is 'Optional Prompt' -- simply change it from the default of False to True.
Then, in your record select logic you can use the HasValue() function to check whether the user provided a value for that parameter.

how to avoid cascading in ssas parameters in ssrs report and load default "all" when report loads?

i have a ssrs report which uses ssas data source and all of the parameter in report also come from ssas data source. the problem is parameters are acting as cascading parameters. i can not have values in parameter drop-down until i select parameter from previous drop-down.
i wanted to have default value "All" selected when report loads instead of waiting for selecting first parameter and then load subsequent?
i have removed #parameters from parameter data source and now here is how my MDX looks like:
WITH MEMBER
[Measures].[ParameterCaption] AS [Category].[Category ID].CURRENTMEMBER.MEMBER_CAPTION MEMBER
[Measures].[ParameterValue] AS [Category].[Category ID].CURRENTMEMBER.UNIQUENAME MEMBER
[Measures].[ParameterLevel] AS [Category].[Category ID].CURRENTMEMBER.LEVEL.ORDINAL
SELECT
{
[Measures].[ParameterCaption],
[Measures].[ParameterValue],
[Measures].[ParameterLevel]
} ON COLUMNS ,
[Category].[Category ID].ALLMEMBERS
ON ROWS FROM
( SELECT ( [OwningEntity].[Entity ID] )
ON COLUMNS FROM
( SELECT ( [Organization].[Organization] ) ON COLUMNS FROM [PerformanceScores]
))
Create Additional data source , point your first parameter with default value "from query" to that data source - This parameter need to be on the top of the list as in SSRS order of parameters is important.
- Let me know if you got any problems.
Thanks
Daniel
Create hidden parameter with IIF statement in default value.
in IIF put dummy date - this will not execute the report but will fill all the other parameters.
IIF(yourparameter.value="",dummydate.value,yourparameter.value)
Use this hidden parameter as your "Main" data range but default value will depend on visible parameter value in IIF statement when user can choose the range
This should work...

SSRS null parameter to return values

I have two reports bound to each other. On the first report when I choose a field I am lead to a second report showing only data from the row I selected in the first report. The second report is used for updating, therefore it takes in parameters. I have three text-boxes which allow a null value and a dropdown list.
First when I created the dropdown list and specified the values, and added a null value the report returned the row I selected in the first report with all the data. Now I tried to assign the values of the parameter to a database, but each time I get to this report it first asks to select a value from the dropdown and then it will display the data.
How can I add a Null value to the items retrieved from the DB so when null is selected as default then all values would be returned without any problems, and without any selection needed?
You would need to add a condition to your Dataset query to handle the NULL parameter.
For example:
WHERE #Parameter is NULL or ColumnValue = #Parameter
Working with NULL valued parameters, I usually use this syntax:
WHERE ColumnValue = COALESCE(#Parameter, ColumnValue)

Separate parameters for Date and Time

I want to use one parameter for date and another one for time in my reports as shown below.
Start Time [16/01/2012][12.00 am]
Can anyone help me regarding that?
Sure it is a multiple step process:
Set up a variable of TEXT as 'DATE' as the variable value and prompt
Set it's 'Default Values' in the left pane to be '1/16/2012'
Set up a variable of TEXT as 'TIME' as the variable value and prompt
Set it's 'Default Values' in the left pane to be '00:00'
Set up a dataset, 'AvailableDateTime' to combine the two into a legitimate datetime field:
SELECT CAST(#Date + ' ' + #Time AS DateTime) AS Datetime
Set up a third variable of DATETIME to be 'DATETIME' as the variable value and prompt.
Set up this variable to use 'AVAILABLE VALUES' on the left pane of properties to be 'Get values from a query'. Use the dataset from step 5.
You now have set up a separate field for data and time.
Further consideration to avoid user input error. You may wish to tie the first variables to be selectable ONLY FROM values you set in available values or from a query. The problem being if a user fat fingers the date or time it will not run as the system is only trying to combine two strings and make a datetime out of it. You may wish to list values directly from a query from the getgo.
EDIT FOR CHANGING FIRST TWO VARIABLES:
You may set the first variable as datetime which gives the end user a calendar.
You can set a second dataset up to get available times for an end user:
declare #time table ( tm int)
declare #cursor int = 0
while #cursor <= 23
Begin
insert into #time values (#cursor)
set #cursor += 1
End
select cast(CAST(tm as varchar) + ':00' as time) as HourOfTheDay
from #time
Setting your second variable to get values from a query that is made in step 2 directly above.
You should now be able to put the values together as above.
As I said in my comment, SSRS does not allow you to have separate parameters for Date and Time.
It has only one parameter Date/Time.
As I see you have two options.
Add a text parameter and consider that as time. You could then do
some validation depending on what tech you are using.
Another way to solve this would be creating a list of possible
values. You select Integer type, for instance and then create a list
of Available Values. (see images)

SSRS report parameters

In my SSRS report there are 2 parameters called DataSourceIDList and ReporterIDlist.
DataSourceIDList : is a drop down list and this will populate based on SQL query.
ReporterIDlist : is a drop down list and this will populate reporters based on selected Datasourceid from DataSourceIDList and this is also a SQL query.
both parameters are optional fields but when i am running the report i am getting error called "Please select value for DataSourceID" but i set the property for that parameter as allow NULL values
and same problem for ReporterIDlist also.
Please suggest your suggestion....
Thanks in advance...
I think that SSRS will not allow you NULL value if parameter have datasource.
Trick that I do when I need all values that is: I change data source for parameters that is in list have
null, or ( 0) value, and option select ALL, and after that I set default value to null so users do not have to touch parameters before it call it
Something like this,
Select 1,null as ValueOfParam,'All values' as TextOfParam
union all
select 2,id,name from myDatasourceThatHaveParamValues
order by 1,name
to verify date, you can use this method too:
make two rectangle; insert table/matrix in first rectangle
in second rectangle insert msg like
"Selected Date is not valid, please select correct date"
or "Start Date should be less less than End Date"
put appropriate msg, and make condition in 1st rectangle where all tables/matrix is there
iif( Parameters!StartDate.Value < Parameters!EndDate.Value,false,true)
in second rectangle where Error msg is inserted write this:
iif( Parameters!StartDate.Value < Parameters!EndDate.Value,true,false)