I am new to this webiste and SSRS.
I have data in the below format. I am getting below data from a procedure based on logged on user.
Empid Field_Name
100 C_By
200 R_By
300 C_By
400 R_By
500 C-By
I would like to create a report parameter which accepts values from empid based on Filed_Name. ex: I want filter the data empid where Filed_Name='C_By' value.
Thanks & Regards,
Ravi
I am not sure if I read your question right but what I believe you asked is you have two parameters that one is dependent upon the other.
You can have cascading parameters. What you need to do is to setup your EmpID parameter to use a data set for its available values and set the parameter for that data set equal to the value of the field_name parameter.
Cascading Parameters
If this is not what you need, you may want to rephrase your question.
Related
I am trying to populate a dropdown based off another dropdown parameter. I have 5 parameters, but the first 3 populate the 4th in the report. So the 4th and 5th parameter are what the user uses to populate a report. So the 4th parameter (meetings) has a meetings dataset and the 5th parameter is meetingType with a dataset of meetingType. So when the user selects a meeting, then the meetingType gets populated by that selection. Currently both dropdowns produce all results, which I don't want. I just want all results for meetings and then the meetingType gets populated by meeting.
The table it produces once the report is ran doesn't use those properties and there isn't a place to query anything. I can only use available values from each dataset and not use available values based on the selection of the 4th parameter.
I'm not really clear. do you need a parameter or do you just want to have the meeting type available as a value in your report output?
Fairly straightforward. You have two datasets, one for each parameter. You need to filter the second dataset based on the first parameter.
For example, I often create reports that ask for a range of values, let's say programs. Once the user has entered the beginning value, the ending value must be greater than or equal to the beginning value. So, on the ending value dataset I create a filter. In this case, the filter says that the field code (which is my program) must be between the starting parameter and the maximum value allowed:
You can make your filter as complex as needed - referring to the other parameter with a formula
You can also do this via separate datasets for each parameter.
Lets say you have two parameters #param1 and #param2
you want the values on #param2 to change based on #param1 selection.
You will have your main dataset (main_dataset) with a where clause something like this
where sometable.somecolumn = #param1
and sometable.someothercolumn = #param2
Now you create a dataset (param1_dataset) for #param1 which brings back all the values you require for this parameter
Now create another dataset (param2_dataset) form #param2 and add a where clause to it which restricts the returned list.. something like this..
where sometable.somecolumn = #param1
Now on your report parameters.. set the Available Values for each parameter (report parameter properties) to "Get Values from a query" and select the appropriate dataset and the value field and label field (returned by the dataset) for each parameter.
Now when you run your report, your parameter selection 2 should change based on what you selected for parameter selection 1
I need to combine the results of multiple similar Stored Procedures into a single Tablix.
I'm using multiple Stored Procedures that return the same data, but for varying Units. So in one "cell" (I don't know if that is the correct terminology for a data field in a Tablix) I have an Expression like so:
=IIF((Fields!Week.Value="WK1"),Fields!Price.Value,"")
...which conditionally displays data when the value of the "Week" field is "WK1" and the Stored Procedure for a Unit value of "BARNEY" is the dataset.
After that (on the same row, in a column to the right in the Tablix) I need to show the same data from a different Stored Procedure where the Unit value being used is "RUBBLE". I need the Expression to reference an existing value (ItemCode) in the Tablix from the first Stored Procedure, so that both cells on the row are displaying values for the same ItemCode (but different Units).
That cell/field is a simple pointer to the ItemCode value returned from the Stored Procedure:
=Fields!ItemCode.Value
How can I use a formula to display the data for the ItemCode that the initial Stored Procedure is displaying data for on that row. Something like this:
=IIF((Fields!Week.Value="WK1" AND Fields.ItemCode=[Existing Item Code value in this row]),Fields!Price.Value,"")
?
IOW, what do I need in place of the "Existing Item Code value in this row" to make this work? Could it be something like this:
=IIF((Fields!Week.Value="WK1" AND Fields.ItemCode=TextboxItemCodeData.Value),Fields!Price.Value,"")
?
If the main dataset for the tablix you are working in is BARNEY, then this is the basic lookup expression that you should start with to get data from the RUBBLE dataset.
=Lookup(Fields!ItemCode.Value, Fields!ItemCode.Value, Fields!Price.Value, "RUBBLE")
In this situation, the Price will be returned when the ItemCode values match between the BARNEY and RUBBLE datasets.
This is the expression that may help you hide or show a value from the secondary dataset.
=IIf(Lookup(Fields!ItemCode.Value, Fields!ItemCode.Value, Fields!Week.Value, "RUBBLE")="WK1", Lookup(Fields!ItemCode.Value, Fields!ItemCode.Value, Fields!Price.Value, "RUBBLE"), "")
The first part of the IIf is checking the Week field in the RUBBLE dataset. If the value is WK1, then it displays the Price from the RUBBLE dataset; otherwise nothing.
This might work if you don't have to check the Week value in the RUBBLE data, and just checking in the BARNEY dataset will work.
=IIf((Fields!Week.Value="WK1"),Lookup(Fields!ItemCode.Value, Fields!ItemCode.Value, Fields!Price.Value, "RUBBLE"),"")
I have a report that I am working on that will do the following:
Return results based first on the community selected by the user.
Filter to find alike addresses within the community, based on the number of square feet at each address.
Set the end date (a column within the data table) to a user defined parameter for use in a WHERE at the end of the query.
The relevant information is stored in the following places:
Community: ub_subdivision.descr
Address: ub_serv_loc_addr.location_addr
SqFt: arp_ops.dbo.vw_ub_serv_loc_classifications.SqFt
I have setup the query with 3 parameters:
#Community
#Months
#Address
When the user is running the report, the following should happen (in this order):
The community parameter should populate the values stored in ub_subdivision.descr and allow the user to select the community they want from that list.
The address parameter should populate the values within the selected community from step 1, and allow the user to select the address they want from that list.
Based on the selected address, the query should store the value of the SqFt related to this address and use that in the WHERE statement as follows: WHERE (arp_ops.dbo.vw_ub_serv_loc_classifications.SqFt = #Address)
The months parameter should allow for user input to define how many months of data they want. This parameter is called in the query in the WHERE statement: WHERE (ub_bill_run.def_end_dt > DATEADD(m, -#Months, GETDATE())).
If I save the dataset and create a "table report" in Report Builder 3.0 it does the job of recognizing the various parameters and loading them into the Parameters folder and into the Datasets' parameters.
The problem I have is that I am not able to change the parameter properties to display Available Values and select "get from a query". If I go this route, and try to run the query I get an error that I am using "forward dependencies".
I need the #Address parameter to display the address field as the label, but store the sqft field as the value. This is the way I know how to do this and, unfortunately, it doesn't seem to work.
I would appreciate any insight anyone may have.
Thanks!
John
There is one way to solve this make sure the order should be in the order of
#Community
#Months
#Address
change order to:
#Community
#Address
#Months
just delete existing #month and again add it manually and save it.
i hope it will work for you.
You cannot have parameters based on your main data set.
The forward dependency error is caused because your data set is to be filtered by your parameter, yet it is depending on the same data set to find its' set of values. This is a sort of paradox.
When using queries to define the set of values for your parameters, make sure you create a new data set for each parameter.
Next, make sure the parameters are listed in the order you want them to run. Within the data sets for your parameters, you may use where clauses to make them dependent on one another in the order that they run.
In this example:
Parameter data set for Community:
SELECT DISTINCT ub_subdivision.descr
FROM [YOUR JOINED TABLES]
Parameter data set for addresses:
SELECT DISTINCT ub_serv_loc_addr.location_addr
FROM [YOUR JOINED TABLES]
WHERE ub_subdivision.descr IN (#Community)
Parameter data set for SqFt:
SELECT DISTINCT SqFt
FROM [YOUR JOINED TABLES]
WHERE ub_subdivision.descr IN (#Community)
AND ub_serv_loc_addr.location_addr IN (#Address)
You should also make a month data set for your #month parameter, however it is not dependent on the other parameters so I will leave that to you.
Hope this helps!
I have a parameter asking the user if they would like to "only" include project numbers below 5000.
If they say yes, then I need the parameter to adjust the project field to be <=5000. If they say No, then the project number field should be <=99999999.
I am not sure how to accomplish this, right now I have a dataset where project number = #projnum, and I have #projnum parameter with two values of Yes and No.
I attempted to put an expression on the dataset properties under that specific parameter as:
=iif(Parameters!projnum.Value=1, <9999, <9999999999)
but I get a syntax error when using the < sign. It will work with just a number.
Sorry, new to SSRS and cannot figure this one out.
Why not change your dataset query to use <=:
SELECT *
FROM YourTable
WHERE ProjectNumber <= #projnum
Then adjust your parameter values to the range values:
I am trying to pass multiple values for a parameter in ssrs which is delimited by ','.Limiting the result data set using where condition using split function in stored proc, this gives me results of my report data set
WHERE YEAR(a.month_start_date)IN (SELECT Value FROM dbo.FnSplit(#year,','))
--AND datename(month,month_start_date) IN (SELECT Value FROM dbo.FnSplit(#month,','))
AND b1.branch_cd IN (SELECT Value FROM dbo.FnSplit(#branch,','))
I created a data set to get available values for year filter
Configured the parameter to get available values from my filter data set and also checked option to "Allow multiple values"
Select distinct year(month_start_date) as Year
From [DB].[dbo].[table]
Then I also limited my report data set to accept parameters with following condition.I configured parameter to accept the following value
=Join(Parameters!year.Value,",")
I pass in values in url
http://<servername>/ReportServer/Pages/ReportViewer.aspx?<reportname>rs:Command=Render&year=2012,2013,2014
My filter does not select the values passed thru the url. The report only shows me the list of values in drop down but does not select the values parsed thru url
I am not sure if I am missing anything else. Please suggest.
Thanks!
The issue here is that your URL is constructed incorrectly. You are trying to pass througth the years as a single parameter and that isn't how it works. Pass it through as a whole heap of parameters and then let the reporting server put it together and put it into the SQL.
Your URL should look like this (I changed the : to %3a and broke up the year parameter)
http://<servername>/ReportServer/Pages/ReportViewer.aspx?<reportname>rs%3aCommand=Render&year=2012&year=2013&year=2014
I hope this helps someone out.