I'm using Report Builder 3 which runs a stored procedure and displays a simple table. Next, we would like to filter based on the first column of data. The first column of data might have 20 rows, and 3 possible values.
How can I make Report Builder display those 3 values in the parameter dropdown, without rerunning a SP or Query from the server?
(Running the SP that obtains the data takes several seconds, and it is not reasonable to rerun another query in order to populate the parameter dropdown)
What I've tried:
1) I create a parameter dropdown and select the column name as values for the dropdown. Instead of getting 3 unique values, 20 rows appears in the parameter dropdown, with duplicates corresponding to the original dataset results. How can I make them unqique?
2) Grouping by the values in the first column. Grouping works, but we would still like to display a parameter dropdown that contains unique values from column one.
Related
I haven't been able to make a DLookUp function work in an Access report. I can't figure out what I'm doing wrong.
The report is getting its dataset from a query called Aggregate Query. This query builds a dataset from 20 related tables using CustomerID as the primary key in one table and as a foreign key in the other 19. CustomerID is specified by an open Form with the desired customer's record displayed, including the CustomerID field.
This means Aggregate Query has several rows for one specific CustomerID. One field, Needs Notes, will have the same content on every row. What I'm having trouble with is getting only one of these rows displayed in the subreport, and subsequently on the parent report.
If there are six rows, say, in Aggregate Query, then the same Needs Notes field is repeated six times. I want it to appear only once in the subreport.
I couldn't choose only the first row from Aggregate Query. If this can be done that'd be great. I don't know.
So I created another query, Need-notes Only Query, which always gives me only one row every time. So far so good. Now I want the contents of the Needs Notes field to appear all by itself in the subreport. To do this I selected the text box and entered the following into the Control Source parameter:
=DLookUp("[Needs-notes Only Query]![Needs Notes]","Needs-notes Only Query")
No dice. I get six rows saying #Error.
Is there a way I can get just one row of the Needs Notes field into my report?
Split field and table names:
=DLookUp("[Needs Notes]","[Needs-notes Only Query]")
I am designing a report for SSRS. I want the user requesting the report to be able to specify, when they generate the report, from a pre-defined selection some values which should be displayed in a tablix on the report.
I have therefore created a multi-value parameter and populated the Available Values with the options I want the user to be able to select from, and, as expected, when the report is generated the user is able to select one or more of these values.
However, what I now want to do is include a tablix in the report, and display a row for every value in the multi-value parameter that the user selected, with the value displayed in the first cell of the row.
If the values were coming from a data table this would obviously be easy. I've also found answers on how to show all of the selected parameter values in a single textbox using the JOIN function, but I don't want to do that.
The only solution I can think of is to replicate the list of available values in the multi-value parameter in a tablix manually, and link the visibility of each row of the tablix to the selected state of the corresponding value in the multi-value parameter, but that's not very elegant and increases the effort involved in maintaining the report definition.
Any ideas on how to do this? I know the selected values from the parameter simply form an array, but I can't see how to bind a tablix to any data that isn't in a dataset, or how to create a dataset from the parameter values.
Considering that a tablix sources from a dataset, I did some experiments to see how to create a low maintenance solution for you.
Option 1: Create a data set with hard-coded options to match your multi-value parameter and select those options WHERE they exist in the parameter.
Example:
SELECT val
FROM (
SELECT 'opt1' as val
UNION SELECT 'opt2'
UNION SELECT 'opt3'
UNION SELECT 'opt4') a
WHERE val IN (#Param)
Thoughts: easier to maintain than visibility on a table, but still two hard-coded places within the report.
Option 2: Create a dataset that selects the multi-value parameter and splits it by each value. This was my first idea, but I ran into some issues with determining how to actually select the multi-value without a syntax error. I came up with a method that creates a deliminated string in the report and than parsed that string back into rows in the dataset:
Step 1) Within the dataset properties, on the parameter tab, join the multiple values together with a JOIN expression
Step 2) Create a simple query which uses the new SQL Server 2016 function string_split. Note that your database compatibility level MUST be 130 or higher to use this function (SQL 2016+). If this isn't your scenario, there are many string split functions that you can find on Stack Overflow to achieve the same thing.
Fun problem!
I am generating a table in SSRS based on the selection made by the user on two filters: Filter1 and Filter2 (say). The table so displayed has 10 columns and I wish to add filter option listing all available values for that column for all 10 columns.
Basically, I am trying to replicate the Excel functionality of filtering down data on each and every column.
Please note that I tried creating a new data set and a parameter taking all distinct values for a particular variable. However, I am still not able to get the desired results by filter the tablix on that parameter
Is there a way I can do that?
You'd need to make a new dataset that is a smaller version of your main dataset. It would need to return all potential values for the column(s) you want to filter in a single column to be used in a parameter.
Without seeing the design of the report or the dataset itself it's quite hard to be more specific.
I have a dynamic SQL stored procedure returning multiple number of columns for different items.
For example, item1 - 5 columns, item2 - 4 columns
I am thinking of building SSRS reports using that stored procedure hoping to get multiple results.
For example, when click 'item1', it gives you that 5 columns sp can return whist click 'item2', it gives you that 4 columns sp can return
Can SSRS do this? When I use SP as a source for SSRS, it seems that the output is NOT dynamic as it only returns 'item1'
thanks
r
RS will read column metadata from the first result set of the query.
So I suggest you can add a table variable (fixed columns to support all your dynamic results) into your stored procedure, insert the dynamic query result into the table variable, and then select the result from the table variable.
what I did is to create a 'big table' in SSRS and manually create fields sp potentially returns and only display the columns based on the sp outputs by using 'viability' option
the only issue is that you need to manually configure each column to indicate under what circumstance it is supposed to appear
I am creating a report in SSRS. I have a table showing the date and time the report was generated, it's a single column table with one expression =Now() and is not linked to any datasets.
The trouble I am having is that it returns 77 rows all with the exact same date. My main dataset returns 77 rows in a different table but that table is not linked to this one in any way.
How can I stop it from returning so many rows? The reason I'm using a table and not a text box is because I want it to have the same look and feel as other data presented in my report i.e. Header Row and Data Presented underneath. There are a few tables that use the same approach and all of them are returning duplicate rows. As you can see from the image below, I just need the first row from each table.
EDIT: Looks like SSRS automatically references a dataset when I insert a new table. When I change the table properties dataset to none it returns an error. Is there a way around this? I don't want data from any dataset, just want to use an simple expression =now()
As you've seen, a Tablix requires a DataSet, and when you only have one DataSet in a report it will link to this DataSet automatically in some circumstances.
You've mentioned you don't want to use Textboxes, but this does seem like the easiest option.
If you're set on using a Tablix for ease of formatting, to prevent any repeating rows just delete the Details group that gets set up by default when you create a Table through the designer:
This leaves a table with one header row only - you can add more header rows as required:
The result is a table that will only display the header rows once, i.e. no repeating rows.
You can add Summary data or individual fields from the DataSet to these header rows; if no aggregation is specified it will just take the first row by default.