Bind Dropdown in SSRS with all column name of Dataset - reporting-services

I need to bind dropdown in SSRS with all column name of dataset.is this possible to select all column name from dataset in SSRS.please help me....because I am stuck in from last 10 days.

First, create a dataset out of those column names:
SELECT *
FROM [yourschema].INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = [yourtablename]
Then just add a parameter, call it what you like.
Then, for available values, choose to get it from a dataset.

Related

Need help to write expression in ssrs to calculate a field on condition basis

i want to create field C from field A and field B the logic i want to use to calculate C field is this C=(A-(B*.05))<0,0 else value.
did you want an expression in a cell or a separate column for you dataset?
as a simple expression
=iif((fields!a.value - (fields!b.value * 0.05)) <0,0,(fields!a.value - (fields!b.value * 0.05)))
If you want it as a calculated column then simply right click on your dataset and select
Add Calculated Field , give it a suitable name and use the same expression above.
You should be able to then use this column in your report like any other column.

how to group and filter on aggregate in SSRS

I have a requirement to report the number of people who have more than one record in the dataset for my SSRS report and I can't quite get how to filter on the grouping.
So if the dataset results are:
ID PersonID FileID
1 1234 abc
2 7890 ade
3 5647 aer
4 1234 xyz
I would like to report 1. There is one person who has more than 1 record.
Is there an expression or something I can use to do this?
Thank you.
You can use LookupSet and CountDistinct function to get the required count, however you will need the textbox used to show the calculation be in a scope.
If you want to show the number of persons with more than one record as a total in your table use this expression:
=CountDistinct(
IIF(
LookupSet(
Fields!PersonID.Value,Fields!PersonID.Value,
Fields!ID.Value,"DataSetName"
).Length>1,Fields!PersonID.Value,Nothing)
)
Set it outside any group scope:
However if you want to show the number of persons with more than one record outside your tablix in a textbox, you can add an additional tablix and delete the necessary rows and columns to leave only one textbox then set the dataset property to the dataset name you are using and use the same expression.
It should produce:
Note my dataset has more rows to ilustrate the functionality. In the right side there is only one textbox with the count.
Let me know if this helps.
If you want the result to be something like shown below.
Steps:
Create a group on Person ID
Right Click on Group > Add Total > Before
Add a column and put =Count(Fields!PersonID.Value)
If you want to display only Persons having more than one, set the visibility property of the tablix row.

setting parameter drop down to the max date in the list

An SSRS report has multiple parameters, each using it's own stored procedure and dataset. The user first selects a school district from a drop down list. From there, a second drop down populates with the schools in that district.
Once the user picks a school, a third drop down populates with a list of certification dates from which the user can select one. All the queries and drop downs populate correctly.
How to display the most recent date instead of the <Select a Value>?
As an example, for school A, there are three dates from which the user can select one, the most recent being 07/30/2015. The query sorts the dates in Desc order so I want the first one be the default, not <Select a Value>. Rather than go into all the things I've tried, how can this be done?
I usually have a separate dataset for the parameter query and add a MAX column with a subquery to find the latest date.
SELECT DISTINCT CONVERT(VARCHAR(10), checkprintdate, 101) AS CHECK_DATE,
(SELECT CONVERT(VARCHAR(10), MAX(checkprintdate), 101) AS X1
FROM paycheck AS P2) AS MAX_CHECK_DATE
FROM paycheck
ORDER BY CHECK_DATE DESC
I use the CheckDate as the Value and the MaxCheckDate as the Default.
The 'Select a value' (sorry about the missing piece, I didn't realize it wouldn't display with the <>) was the text that was actually showing up in the drop down box, rather than 'ALL' or an empty box. The user should be allowed to select any of the three dates, not just the latest (so I couldn't use the MAX() in the query). But, in any case, I changed the Default values (in the Report Parameter Properties box) on the CertificationDate parameter from 'Specify values' to 'Get values from a query', then put in the dataset name and the field name for the 'Value field'. The most recent date now displays in the drop down box (without the user having to click the down arrow and click on the value). Thanks for the responses.

Lookup function in SSRS report

I have one dataset Dataset1 and in that I am displaying data based on grouping. The data is like this
CityColumn CountColumn
City1 5
City2 3
The query of above datase is like this :
select count(*) as "CountColumn" from City group by CityColumn
Here in above dataset I have counted using grouping on CityColumn.
Now I have created another Dataset Dataset2 and in that The data is like this
CityColumn
City1
City2
City3
Now in dataset2 I have add one calculated field called TotalCount and used the Lookup Function the function is like this
=Lookup(CityColumn, CityColumn, CountColumn, "Dataset1")
but It gives me an error like
Lookup includes aggregate, rownumber, runningvalue, previous or lookup function. Aggregate, rownumber, runningvalue, previous or lookup function cannot be used in calculated field.
The first two values of the lookup function must refer to an identifying value in a column. In your case the City names must be in both datasets. Think of that as a primary key. The third value is the one you want to display from the second dataset. So it should look more like this:
=Lookup(Fields!CityColumn.Value, Fields!CityColumn.Value, Fields!CountColumn.Value, "Dataset1")
Make sure that Dataset1 has the column named CountColumn that you are trying to lookup. Keep in mind that this only looks up individual rows, not aggregates. If you want to work with aggregates you can do that on top of the lookup function.
EDIT:
Since Lookup functions are not allowed in calculated fields, you'll need to use it in the Value expression in your pie chart. It should look like this:
Note that the lookup function has to be in an aggregate like a sum function for it to work as a chart value.
Instead of adding it as a calculated field in the DataSet, simply add the expression into an empty column within the details rows of the report.

Parameters in a report

I am using microsoft reporting 2008 and I would like to set parameters in this report. I do not want to pull back a list that contains the same...such as year...I pull up my parameter and I have a hundred 2010...I just want one to appear in the parameter but I want my report to show all hundred. How do I do this?
I'm guessing you want to base your parameter selection on a query of available values that will appear in your report, so you have hooked it up to your dataset for your report.
Create another dataset that is like your report dataset but only returns distinct values and use this as the query for available parameter values.
For example, if your report dataset is something like this:
SELECT Year, Amount
FROM MyTable
WHERE SomeValue = 1
use the following dataset for your parameter query:
SELECT DISTINCT Year
FROM MyTable
WHERE SomeValue = 1