I have a quite strange / unusual request for an SSRS report. The client wants to be able to paste in large lists of ID numbers from an Excel sheet column (normally < 100 values but can be as many as 20,000 + values) as a search parameter in the report.
Now, I know how to pass multi value parameters from SSRS to a stored proc etc, that's not the issue. The issue is with this requirement to literally paste in a list of IDs into the multi value parameter input box and then limit the dataset based on that list (rather than pre-populate the Multi Value parameter with a list of values based on a query / SP as you normally would)
My question is what would be the best method / approach to this problem as I have never had a similar ask in many years of SSIS development? I need to make the solution as "self-service" as possible too, so as easy as running an SSRS report from report manager ideally. I know I could just import the Excel data into a table in the database and join to that etc but ideally would like something the user can run without the need for any tech input to import data or run SQL through SSMS to get the datset.
When you copy/paste from excel its just a tab delimited string. You can configure a string parameter to allow multiple values, and then in the expression editor, split the string by tab values or by line breaks.
Here's how:
In the parameter properties check the 'Allow multiple values' checkbox on the
general tab
Then in the datasource properties click the 'fx' (expression) button next to the parameter on the parameters tab
In the expression editor that appears, type the following:
=replace(split(Parameters!MyParameter.Value,vbCrLf),"\x0009","")
This will split the string by line breaks, then strip the tab characters out. After that you can treat it like any multi-valued parameter.
If you have a typical multi-value parameter setup then you can just copy/paste the column from excel directly in, it will automatically put each cell row copied from excel on a new line.
So if your query looked something like
SELECT * FROM myTable WHERE EmployeeName IN(#empName)
and empName was you report parameter, if no available values are configured you'll get an empty list when you click in the parameter field, just copy paste direct from Excel and it will work.
I'm not sure if there would be any limits or how good performance would be especially if copying thousand of values but certainly for a reasonably small number of items this will work.
The only other way I can think of that means no real extra work for the user would be to have them drop the workbook into a specified folder (maybe with a subfolder based on their SSRS username, then use openrowset to read the contents either directly into a dataset or better still, into a permanent table with their username and the parameter value on each row.
The openrowset statement could sit at the top of your main dataset query
Then your query could do something simple like
DELETE FROM myParamValueTable WHERE UserName = #UserID
INSERT INTO myParamValueTable
SELECT * FROM (OPENROWSET .....) xl
SELECT * FROM myTable t
JOIN myParamValueTable p
ON t.EmployeeName = p.EmployeeName
WHERE p.UserName = #UserID
Related
My quality engineers have asked me to create a report based on a document that they fill out manually. At first glance, it appeared to be an easy enough request. It has been anything but easy. This report shows the results of two inspections and I have a parameter where the user selects one inspection or the other. As it stands now, this report runs just fine when selecting one inspection, but I am anticipating a request to be able to run the reports for both inspections at the same time. And, that's where I run into trouble.
The problem is that I have a text box in the header that is referencing a value from a table in the report that identifies the inspection. When I set the parameter to a multi-value parameter and select all, the report only displays one of the inspections across the entire report. Is it possible to have the user select both inspections but have the report run them separately? I have one dataset for the table and a column in that table that identifies the inspection. I have tried the multi-value parameter and I have tried using the filter option in the dataset properties, but I get the same result.
The easiest way to do this might be to create a new master report and use your current report as a sub-report. It's fairly simple.
Here's the basic steps...
Make a copy of your current report and rename it (say sub_InspectionReport)
Change this report so the the inspection parameter is NOT multi-valued
Create a new report and add your parameter(s) the same as you setup for your original report, This time make sure your Inspection parameter (e.g. pInspection) IS multi-valued.
Create a dataset (dsInspectionIDs) that returns a list of the selected inspection values from the pInspection parameter. The query could be something simple like
SELECT InspectionID FROM myInspectionTable WHERE InpectionID IN (#pInspection)
Note: #pInspection is the name of your report parameter, it is case sensitive.
Now add a table to the report and, as a simple, test, se the dataset of the table to your daatset dsInspectionIDs. Set the first column to show the only available field (in this example InspectionID).
Run the report and test the output using different inspection parameter selections. The table should match what you have selected...
We're almost there...
Now in one of the table cells (but not in the header) , right-click and select "Insert / Subreport". Now right-click the sub-report placeholder and set the sub report to be the copy of the original report we made at the start (sub_InspectionReport in this example). Now, still in the sub-report properties, go to the parameters tab and set the Inspection parameter to the the InspectionID field.
Now when you run the report, you will get your sub-report run once for each selected parameter value with that parameter passed to the sub-report.
Hope that makes sense, I'm not near my PC so I can't provide a sample with images at the moment.
Currently we create Jasper PDF Reports from a single simple database table for our customers. This has been achieved programmatically. It's static. If the user wishes to change the query, he/she creates a change request, which we cannot deliver before the end of the next sprint (SCRUM).
The tool/library should be straight forward (e.g. convention over configuration) and employable from within a JavaEE container. And, open source.
Is there a dynamic tool that allows or customers to create the simple queries/reports themselves without knowing SQL? Means, they should be able to see the table and then create a query from it, execute and print (we could use Jasper Reports for the last one).
E.g. Select only data from year 2014, aggregate them by customer group and select columns x,y and z.
All of these criterias and query structure may change though, thus not just the value like year 2014.
Questions:
1) Is there a tool that presents the data in some kind of SAP-cube or something similar where the user could select the structure and attributes?
2) Can that tool save template queries (queries that the user has invoked before)?
thanks
With BIRT you could use parameters in the report... for example have one report that shows the whole data set or data cube (or at least a bit of all of the fields). Then you could add JavaScript to the report (or do all of the presentation in JavaScript for that matter), that shows the parameters a user can select from. These parameter values can then either be sent to a new report or could update the existing report. Parameters can be put into database queries too.
If that was exposed in JavaScript on a web page you could save the parameter values to an array and store them in the browser or server.
I want to create a VBA program where it connects to the database you give it (hard coded). From here you are to program a cell to take the input for the WHERE clause in the query and then in a separate sheet it outputs the queried data. I do not want to filter this data, I need to query it. Can anyone help?
You can do this using Microsoft Query. The basic steps are:
1 - Connect to the database using Data>From Other Sources>Microsoft Query
2 - Modify the resulting query by right-cliking the resulting table and choosing Table>External Data Properties and clicking the little icon in the upper-corner. Then choose the Definition tab:
3 - Right-click the table and choose Parameters. In that dialog you can set cells to hold the parameters for the Where clauses.
For more info on this see this MSDN page and this Daily Dose post.
I have a Report in SSRS 2008 that looks like so:
For the Sales Attendees and Other Attendees it may have more than one person that needs to go in that row. As you can see from the screenshot right now it just creates another row. How would I make it so they go into the same row instead of creating new rows?
EDIT: I have to use FetchXML. I'm working against CRM 2011.
Thanks!
As Brent D mentions, I would rather do this in the data source, but you can do the same thing with the RunningValue function and some custom code. (Another blog entry using the same approach.)
Write the custom code to take in additional strings and add them to the end of a stored string. It will need a second parameter, so you know when to clear out the stored string and start over for the next group.
Once you've got this working, you can use this in a group footer, and then hide your data rows.
You could try concatenating the names with a comma in the sql datasource by doing something like:
Select <main data columns, e.g. RSM/NAM,AppointmentDate,etc>
,stuff((select ','+SalesAttendee From tableB Where TableA.ID=TableB.ID For XML Path('')),1,1,'')
From TableA
See SQL Concatenation for reference.
I have a stored proc in sql-server and one of the parameters it returns is a string with the query parameters. I display those query parameters at the top of the report. That works great if something is found, not so great if nothing was found.
We have tried returning two query results, one the data set that I will make the report from (which includes the query parameters), the other the query parameter string. Crystal appears to only see the first data set, and this very old discussion (http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=42462) says that is not something that will work. But that was over 5 years ago, and I'm hoping things have changed.
The problem, is if nothing is returned, the report is so blank that the person doesn't even know what query parameters they used. If they could see that they queried something that doesn't return any results, that would be useful.
So, if I have at the end of my stored proc:
SELECT * FROM [#ResultSet]
select #SearchCriteria as SearchCriteria
I'd like to be able to display the SearchCriteria even if there is nothing in the #ResultSet. Can it be done with this version of Crystal? Is there another way to do this?
Unless as stated by the first answer the results of one procedure have the same number of columns of another procedure (this includes type), if this is the case you can UNION the results or UNION ALL the results (if you want duplicates) to get ONE resultant set.
If the types or columns are not the same then you cannot do this. The only other option you can do is to merge all the relevant data into a temp table and then return the results from that temp table (SELECT * FROM #temp)
How are you currently able to display the parameters when results are found?
You haven't mentioned how you are using the Crystal Report in your environment.
Typically, I've done criteria display by passing the parameters to the Crystal Report as Report Parameters, and then using them in fields. This assumes you are calling it from a client application in some way.
Another option is to load the results into client datatables and binding to that as a datasource, it's certainly possible to handle the multiple result sets that way.