I am trying to figure out how to display results based on multi selection of the user.
So top drop down has a list of countries that a user can select from. This is how I am trying to get the list but the expression only wants to pick the first one. How do I go about it selecting all selected values.
It works fine for one selection but not for multi selections
This is how I updated it with based on comment. But getting an error
The FilterValue expression for the dataset 'XXX' contains an error: [BC30205] End of statement expected.
The definition of the report '' is invalid.
----------Update two----------------
So removing the extra ( helped and the report is rendering but the multiple selection is not responding in the report itself. You can see, I have Country of Interest: United Kingdom, United States... But nothing displays on the report.
Its a drop down list but as the user starts selecting, they start showing up in a comma separated list.
Here is how the query is built
Related
Is there a SSRS guru that can help me please?
I have a report that generates a tabular list of Claims as follows:
The dataset contains a single table and multiple records with a RecordID, Carnet Number and Claim Number. The RecordID is not shown on the report.
I then have a different report, lets call it "LETTER", that is in a letter format:
The LETTER report prints a letter containing information for a single Claim and its content is extracted from the database by using the RecordID.
I have added the LETTER report as a sub report and it is linked to the main report via the RecordID.
Requirment
The first report must generate as normal and list all the Claims in the dataset. The subreport LETTER must then generate for EVERY claim shown on the first report. Each LETTER must be on a seperate page as it will be printed on an official company letterhead. No direct printing to a printer is allowed which means the reports must be shown as a single report for the user. The default SSRS page navigation etc functions will be available.
Problem
The subreport LETTER must be generated for each RecordID. Currently it is only generating for the first RecordID.
How do I ensure that there is a LETTER for each claim that is listed?
Thank you in advance.
It sounds like you're going to need to add all of the elements of the letter into a list item and group by the RecordID field. I did something similar for a small report in the image below. Basically, add a list item and set the dataset to match your claims dataset in the Tablix Properties. Then, open the Group Properties, group on RecordID, navigate to the Page Breaks tab and add a page break between each instance of a group. This should produce a new letter for each RecordID.
Using Report Builder 3.0 against cubes which are produced overnight.
The report I'm designing is used to archive or transfer (physical) files for patients. Users run the report, print it & then attach it to files that are then sent to a central area which will archive/send the files on.
The report has a number of parameters which is designed to return a single patient. This all works fine.
One of the parameters (#prmReason) is a single choice on what is to happen to the files, eg, "Transfer" (transfer files to another office), "Archive - closed", "Archive - deceased", "Archive - excess" (office space is limited, so staff archive off 'older' files).
One of the fields returned is CloseReason. This field always has a value. If the field is empty in the database (as the client hasn't closed), then it will contain the value: "Unknown".
This field (amongst others) are either displayed or hidden, depending on #prmReason. Again - all working without a problem.
Now for the tricky bit.
If the #prmReason = "Archive - closed" or "Archive - deceased" then the report will display CloseReason.
The problem is if CloseReason = "Unknown" then I need to know the why the file is closed & display it on the report.
I want users to be able to choose a value from a list of closure reasons. I then want the choice to be displayed on the report. Obviously if there is a genuine reason then display this value.
So the effect I'm after is:
User selects parameters & runs report.
Report then checks to see why report is being run (eg #prmReason).
If #prmReason =("Archive - closed" OR "Archive - deceased") AND CloseReason = "Unknown"
Then somehow produce a list of CloseReasons that the user can select. This value is then displayed on the report.
I can even cope with it being a free text field. Just something so that the central area can update the database if necessary & save a phone call/email etc.
(Yes, I realise that I can have the list as a series of tickboxes that the user ticks after the report is printed, but this would be a useful ability in other reports).
EDIT: empty value of CloseReasons conflicted with stackoverflow formatting (sorry didn't review post properly). Value is actually less then symbol then the word Unknown and then greater than symbol. It doesn't really affect the problem
You could add an additional hidden parameter.
If this parameter is not set then display an small table on your report that has a list of CloseReasons.
You then set table cell's action property to open the a report, choose your existing report as the report to open but this time you can pass a value for the final parameter, which, as well as displaying the Close reason in your report, would also hide the close reason choices table described above.
UPDATE To make clear more clear.
The following is based on the Northwind sample database. I have a shared data source pointing to this database.
Create new report.
Add a data source pointing to the shared Northwind data source
Add a new data set pointing to the data source above with the following query
SELECT
EmployeeID,
FirstName, LastName, Address, City, Country, Title, Notes
FROM Employees
WHERE EmployeeID = #EmployeeID
Add some of the fields to the report to show some basic info.
We now have a simple report with a single parameter #EmployeeID
Next we want to show some actions for each employee. For flexibility, I'm making this list dynamic based on the employee's Country. This list could be static.
Create a new dataset dsActions with the following query
DECLARE #actions TABLE(ActionID int, ActionLabel varchar(20))
-- Get employees country
DECLARE #Country varchar(20) = (SELECT Country FROM Employees WHERE EmployeeID = #EmployeeID)
IF #Country = 'UK'
BEGIN
INSERT INTO #actions VALUES
(1,'Sack them'),
(2,'Buy them a pint'),
(3,'Promote')
END
ELSE
BEGIN
INSERT INTO #actions VALUES
(1,'Fire them'),
(2,'High 5 them'),
(3,'Ask them to run for office')
END
SELECT * FROM #actions
Add a table to the report to show these values.
At the moment my design looks like this. (All the expressions are simple fields from the first dataset to show the employee details, nothing special)
And when I run it I get this.
OK, now all the basics are done, we need to be able to call this report again, but with an action already chosen. We'll make the actions table clickable and pass the action's label to the report.
It's the same report, we will only ever have a single report.
First, add a new parameter called action to the report and make it hidden. Add a default value of 'noaction'.
Next we want to only show our actions table if the action parameter is set to 'noaction'. To do this, set the Hidden property of the action table (tablix) to the following
=Parameters!action.Value <> "noaction"
Next we want to add a text box that displays the result action parameter, but only when the action parameter is not noaction.
So add a text, set it's expression to =Parameters!action.Value and the hidden property to =Parameters!action.Value = "noaction"
Finally, we need to make our actions list call our report but with a specific action. To do this we need to modify the actions table.
First save the report, whatever name you choose is the name you will select as the target report as the report will call itself.
Right-click the cell that contains the ActionLabel and go to the text box properties.
Select the Action tab and then choose "Go to report". Choose the name of the report you are currently working on (this actual report as the report will call itself).
Set EmployeeID parameter to [#EmployeeID] and the action parameter to [ActionLabel]
I've used the label for simplicity but you could pass the ActionID as long as you account for this in the text box that displays the action.
Optionally you could format the text so it looks like a link,
The final design and action/parameter setup looks like this
When I first run the report I get the following...
As soon as I click one of the actions, I then get this...
Hopefully that's clear now.
I have a ssrs report, that gives me multiple product's price. My Parameter is not drill down, I have to type in the parameters(since I have large range of product number).
Now my questions is, how can i get the last entered product ( parameter) always appear at the bottom of the report ?. This would help me where to look the latest product in the report.For example I have product numbers like:
abc-234,
abc-570,
ght-908,
Now what I want is that the latest entered product number which is ght-908 to appear at the bottom of the ssrs reports. Right now it gives me the report for the multiple product, but its all over the place and i have to squint my eyes and try to find out where my most recent entered product numbers (parameters) is. I have also tried to stop the parameters to being refreshed everytime i add a product number.
Assuming your parameter name is MyParameter, in report designer (BIDS) just drop a textbox onto report below the data (e.g. Table) and put following expression into its value's formula:
=Parameters!MyParameter.Value.Split(",")(Parameters!MyParameter.Value.Split(",").Length - 1)
it will split the parameter list and grab the last value
Update: here is the screenshot with steps:
And here is the runtime result
This expression works for me:
=Trim(Right(Parameters!Product_Number.Value
, InStr(StrReverse(Parameters!Product_Number.Value), ",") - 1))
Trim might not be strictly necessary but is useful as it will work if the values are split with spaces as well as commas, or not.
For example:
It sounds like you want to order the results of the stored procedure by the order of the product codes as they are typed into the report parameter (which is a comma separated list).
You can return the index (order) of each product code in the parameter by using the Array.IndexOf and Split functions, e.g.
If you have a report parameter called "ProductNumber" and you also have a field called "ProductNumber" returned in your dataset, the following code will return the zero-based index of the Product Number as entered into the parameter list:
=Array.IndexOf(
Split(Parameters!ProductNumber.Value.ToString(), ",")
, Fields!ProductNumber.Value
)
So if abc-234 is the first product number in the parameter list then this code will return 0. If abc-570 is the second product number in the parameter list then this code will return 1, etc.
Assuming the products are listed in a tablix, then I would set the tablix sort expression to the above, which should sort the products into the order specified in the report parameter.
I've got a table with 5 columns, the first 3 of which allow the user to drill down through the levels of detail. Each of these columns (Region, Country & Office) has an associated Parameter so the user can select the geographic region for their report. Each parameter allows the selection of multiple values.
If the user selects 1 Region, 1 Country and 1 Office it's not exactly ideal for them to then have to expand each selection. Is there an expression I can enter somewhere to state that if only 1 value is entered in a parameter then that data set will automatically show as expanded?
This is in SSRS 2008 R2 if that makes any difference.
In the Group Properties for the detail group you can enter an expression for the initial visibility. Right now you probably have that set to "Hide." The expression needs to return a Boolean and could be something like:
=Parameters!Country.Count <> 1
This will have SSRS hide those rows if more (or less) than one value are selected in the parameter Country
But I have seen some unexpected results with this: test thoroughly. In my experience, BIDS handles these better than SSRS itself, so just when you think you've got it all working, it fails miserably once deployed. (Reason number 14 to have a test folder on production SSRS.)
I've been assigned the task to design a temporary customer tracking system in MS Access 2007 (sheeeesh!). The tables and relationships have all been setup successfully. But I'm running into a minor problem while trying to design the data entry form for one table... Here's a bit of explanation first.
The screen contains 3 dropdown boxes (apart from other fields).
1st dropdown
The first dropdown (cboMarket) represents the Market lets users select between 2 options:
Domestic
International
Since the first dropdown contains only 2 items I didn't bother making a table for it. I added them as pre-defined list items.
2nd dropdown
Once the user makes a selection in this one, the second dropdown (cboLeadCategory) loads up a list of Lead Categories, namely, Fairs & Exhibitions, Agents, Press Ads, Online Ads etc. Different sets of lead categories are utilized for the 2 markets. Hence this box is dependent on the 1st one.
Structure of the bound table, named Lead_Cateogries for the 2nd combo is:
ID Autonumber
Lead_Type TEXT <- actually a list that takes up Domestic or International
Lead_Category_Name TEXT
3rd dropdown
And based on the choice of category in the 2nd one, the third one (cboLeadSource) is supposed to display a pre-defined set of lead sources belonging to the particular category.
Table is named Lead_Sources and the structure is:
ID Autonumber
Lead_Category NUMBER <- related to ID of Lead Categories table
Lead_Source TEXT
When I make the selection in the 1st dropdown, the AfterUpdate event of the combo is called, which instructs the 2nd dropdown to load contents:
Private Sub cboMarket_AfterUpdate()
Me![cboLead_Category].Requery
End Sub
The Row Source of the 2nd combo contains a query:
SELECT Lead_Categories.ID, Lead_Categories.Lead_Category_Name
FROM Lead_Categories
WHERE Lead_Categories.Lead_Type=[cboMarket]
ORDER BY Lead_Categories.Lead_Category_Name;
The AfterUpdate event of 2nd combo is:
Private Sub cboLeadCategory_AfterUpdate()
Me![cboLeadSource].Requery
End Sub
The Row Source of 3rd combo contains:
SELECT Leads_Sources.ID, Leads_Sources.Lead_Source
FROM Leads_Sources
WHERE [Lead_Sources].[Lead_Category]=[Lead_Categories].[ID]
ORDER BY Leads_Sources.Lead_Source;
Problem
When I select Market type from cboMarket, the 2nd combo cboLeadCategory loads up the appropriate Categories without a hitch.
But when I select a particular Category from it, instead of the 3rd combo loading the lead source names, a modal dialog is displayed asking me to Enter a Parameter.
alt text http://img163.imageshack.us/img163/184/enterparamprompt.png
When I enter anything into this prompt (valid or invalid data), I get yet another prompt:
alt text http://img52.imageshack.us/img52/8065/enterparamprompt2.png
Why is this happening? Why isn't the 3rd box loading the source names as desired. Can any one please shed some light on where I am going wrong?
Thanks,
m^e
===================================================
UPDATE
I found a glitch in the query for the 3rd combo.. It wasn't matching up with the value of the second combo. I fixed it and now the query stands at:
SELECT Leads_Sources.ID, Leads_Sources.Lead_Source
FROM Leads_Sources
WHERE (((Leads_Sources.Lead_Category)=[cboLead_Category]))
ORDER BY Leads_Sources.Lead_Source;
Those nasty Enter Param prompts are GONE!!! However, the 3rd combo still stubbornly refuses to load any values. Any ideas?
Never mind. Found the fix. The BoundColumn property of the second combo wasn't set to the correct column. Hence the selection values in it were incorrect and the 3rd combo wasn't able to refer to the linked table properly (with the correct index).
Job done :)
Thanks to all who may have taken time out to review the problem.