Users of a report have requested the ability to be able to manually enter a code, currently they are are presented a multiselect with all the codes related to the previous parameters.
This is in Report Builder 3.
This multiselect can become quite long so I thought another approach would be a searchable multiselect. Is this possible in any: way, shape, or form?
Could I allow for a cascading parameter (which is the code) to be either selected either through manual typing or another means.
I would add a type-in text parameter (lets call it Search_Code), with a default of % (assuming your data source is SQL).
Then in the data source for the Code list, I would add to the WHERE clause e.g.
WHERE Code LIKE '%' + #Search_Code + '%'
This will restrict the Code list to strings which partially match the Search_Code value (if entered).
Related
I use the MS Access 2013 Expression Builder regularly.
But one thing I've never managed is simply to show only the first (say 25) characters of of a text field on the report.
It would seem to be a no-brainer. I've done far more complex things in Expression Builder without an issue. But shortening a text field on a report always return #Type! no matter how I try to adjust the expression.
It would seem to me that all I need is:
=Left([CompanyName],25)
But it just doesn't work! The report shows a #Type! error.
I can do this no problem by creating a RecordSet SQL string and setting the report RecordSource to it (with OpenArgs). But I can't manage it in Expression Builder.
What am I doing wrong?
When you build expressions for a form, then ANY column that exists in the datasource can be used - EVEN if not placed on the form.
However, reports have a significant difference. Your expressions ONLY work against data bound controls. In other words, the control has to be on the report (no doubt in this case in the details section of the report.
What this means is you have to drop into the details section (and you can and should use in design mode - add existing fields:
So, you need to add the Company name field to the report.
Of course you don't want it to display, so you can delete the label part, and set the control visible part = false. Eg: this:
Remember, you can't have the control reference its self.
In your case, the control you dropped "most" likely is called CompanyName, and then you changing the datasource expression to its self!!!
The other way?
well, you need to RE-NAME your control!!!
If you JUST drop the control onto the report, then its name will be CompanyName.
But, you NOW using =left(CompanyName,25) which POINTS to its self!!!!
So, as noted, you can drop in a company name control and then set visible = false.
The other way, is to CHANGE the name of the control to be DIFFERENT then the company name.
So, you can use add fields, but then in the other tab, rename.
So, say I just dropped in a Description column, but want to use left(10) on it
So, we do this:
Note VERY careful how I re-named the control.
I can't use left(Description,10), since that would refer to the VERY SAME control that I am attempting to use the expression against!!!
I would be saying, please use left of a control called description, but that description s the expression I am wanting to execute against!!!!
So, re-name the control. And now I can do this:
Note the arrow in above - note VERY careful how the control name is DIFFERENT then the data expression (Description) in this example.
Note VERY careful, I can now place OTHER controls on the report, and reference now:
I can reference Description in the expression, OR I CAN USE DescripitonLEFT in that expression!!!!
As you can see, we need a way to distinguish which control we are referencing here. In fact, some developers i have known as a habit NEVER use the same name for their controls vs the datasource of the control for this reason.
In your case the very same expression, and very same control BOTH have the same name - and thus you can't evaluate the expression of a left(Descripiton,10) against the VERY same control with the VERY same name!!!
So, you have to dis-ambiguate the name and the expression you want. In this case CompanyName. As noted, your left("some control") is the VERY same name as your current control.
Try just re-name of the control you dropped into the report.
I am trying to run a Business Objects report in 5.1.9.
When I refresh the report it asks me in a box labelled "Enter and Select Values"
I can either enter a single free text value in the text box or I can type % to leave it unfiltered.
I would like to specify several values in this box rather than one or all. How do I do this? I have looked everywhere on google but perhaps I have the wrong search terms?
Wow - 5.1.9 almost 15 years old.
The box you're seeing is a prompt. Prompts can be defined either in the report's query, or in a universe object that's used in the query.
If it's defined in the query, then it's easy to change. Open up the query panel via Data -> Edit Data Provider (assuming you're using Full Client, WebI is a little different). You'll see the query panel with result object in the top-right pane and conditions in the lower-right pane. Look for a condition that includes the text you see in the prompt. That condition will likely have an "Equal To" operator. Change that to "In List", and the prompt should then accept multiple values.
If the prompt is not present in the conditions pane, then it is most likely applied via a universe object. If you want to make this change for this report only, you could modify the query's SQL (but only if you're using Full Client; for WebI, you'd need to modify the universe as described below). Hit the SQL button, and you will see the generated SQL. First, check off the "Do not generate SQL" checkbox in the lower-left of the dialog. Not doing so will cause your changes to be lost. Look through the SQL for a #prompt() function. Within that function, you should see mono -- change that to multi, and close the panel.
If you don't want to change the query's SQL, or if you want the change to apply to all reports, then you will need to modify the universe object that produces the prompt. You will need to access to Designer, and permission to import/export the universe. You will also need to locate the object that produces the prompt. Once you do, change mono to multi as described above, and export the universe.
Have you tried entering either of the following?
"FreeText1";"FreeText2";"FreeText3"
or
"FreeText1","FreeText2","FreeText3"
(obvs replacing FreeText with whatever your strings are)
I'm not sure if this is possible, but I would like to use 2x Report Parameters for the same SQL parameter.
Currently I have the following in my WHERE clause which relates to a multi-select drop-down:
and traderid in(#traderid)
But I would like to have something along the lines of:
and (traderid in (#traderid) OR traderid = (#traderid2)
so that users can either type the name that they require as opposed to finding in in the vast drop-down list, or choose multiple traders from the drop-down.
In trying so far, I cannot leave the multi-select blank as SSRS will not run the report and you cannot specify the 'Allow Null option' for multi-select parameters.
Does anyone know if there is a way around this?
You need to add a value to your multiselect parameter that effectively means "Ignore this and use the text box".
For instance, add an option to the multiselect with value -1 and label -Enter Manually-.
In your query, do this:
and (traderid in (#traderid) or (-1 in (#traderid) and traderid = #traderid2))
The above assumes your traderid is integer. If not, adjust accordingly.
I am trying to add an optional filter on a text field in a report. I have tried setting it up in the dataset but it treats it as a required filter so if it is not populated, no results are returned. It needs to use the Like operator. Any advice?
As I was typing out a work-around to this problem, I realized an incredibly easy solution (now that I understand better how it works).
Here's what I did:
Since Hong pointed out that all filter conditions must be met, I reversed my thinking. I moved my existing "IN" filters to the query and fed the parameter directly to the query. Then I created by "LIKE" text filter on the report which a default value of "*" so it would immediately return everything.
Here's what I could've done:
Just the last part. Added the "LIKE" filter with a default value of "*" so it immediately returned everything.
I also agree that most of the time it's best to send the params back to SQL. Since that's not what the OP is asking, here is the best option I have found for doing this. And it is actually quite simple.
Add your parameter with the appropriate data type. Let's use the
example of a "City" in this case (a text/string field).
Check "Allow Nulls" on the parameter.
Add a filter to either a tablix, table or dataset.
In the expression, select the field you want to filter on. Select the appropriate operator, in my example of a data set with Cities, in the Value put in this:
=IIF((Parameters!City.Value Is Nothing), Fields!City.Value, Parameters!City.Value)
I don't think you can make an optional filter in DataSet Properties/Filters, adding filters there means returning results that match ALL filter contiditions, so it is "AND" logical relation among all filters, not "OR".
My sugguestion is to use filter in query designer of the dataset, where you can define "OR" relations to filter out data. For instance: Your_Text_Field="SomeValue" OR Your_Text_Field is Empty.
Although I agree that most of the time it is best to send the parameters back to the stored procedure or data layer to reduce the amount of data returned, I have a case where it is just as easy to do the parameter handling in the RDL file via a filter. Due to this unique situation I found this solution which gives you a way to create an Optional filter in the RDL file.
http://www.andrewshough.com/development/sqlserver/ssrs/optional-filter-in-ssrs/
It is a great blog post with easy step by step instructions on how to create an optional filter.
Please Note: This is NOT my blog but I though this solution was great for what I needed and I hope it helps someone else when they google for "optional filter in SSRS" like I did.
I found a post which solved my problem setting the filter for a report-consumer to a) all multivalue fields being selected so the user b) could specify his/her selection if necessary.
Kasim 8 Dec 2010 8:55 AM #
In reports when we want to default the multivalue parameter to 'Select All' following are the steps.
Open the Report parameter window from the Report menu.
Select the Report parameter from the left handside of the window.
Select 'Multi-value' checkbox and appropriate 'Available values'.
Under default values select 'From Query' radio button'.
Select the appropriate 'Dataset'.
Select appropriate 'Value Field'.
Save the Report and select Preview Tab. You will find all the items selected in the multivalue >parameter list and the result displayed for all the selected items.
found on: http://blogs.msdn.com/b/bimusings/archive/2007/05/07/how-do-you-set-select-all-as-the-default-for-multi-value-parameters-in-reporting-services.aspx
(The Post came up in the comments quite in the middle.)
You can accomplish this by using an expression on the dataset filter.
Check this
I'm finishing up my reports in my SQL Server 2008 Reporting Services project, and as one of the last steps, I need to make things translateable.
Since I have a bunch of reports, and they all share some identical labels, I decided to put all those labels I need to show into a SQL Server table, and I am surfacing that contents as a DataSet dsReportLabels in my reports.
This DataSet basically contains two fields: LabelName is the name of the label (e.g. "Count of items"), and Caption contains the text in the chosen language to be shown on the report.
But now here comes my mental block: how do I assign the dsReportLabels.Caption value to a e.g. textbox, based on the dsReportLabels.LabelName ?
So I need something like (pseudo-LINQ statement):
Textbox1.Value = from dsReportLabels
where LabelName = "some value"
select Caption;
but how do I express that in a Reporting Services code snippet?
I know how to reference things like Parameters!MyParameterName.Value and so on - but that doesn't really work here when I'm trying to extract a value from one column of the DataSet, given the value of the other column in that DataSet.
I bet this is totally easy to do in the end.... just can't seem to wrap my head around this right now.... anyone out there know how to do this?
This MSDN blog post describes one way of doing it. Essentially:
Create a lookup table with the LabelID, Language, and Caption.
Create a Stored Proc that gets all of the labelIDs and captions for a specified language.
Store the results of the SP in a dataset.
Store the dataset in a multi-value parameter.
Use the multi-value parameter in a custom lookup function.
So, the expression in your label textbox would call the custom function with the labelID, which would get the appropriate caption for the appropriate language.
Report Server 2008 also has a built-in Lookup function that may allow you to skip steps 4 and 5. If this is the case, your expression would call the built-in lookup function, which would go directly to the dataset. I don't have RS 2008, so I can't test this.