SSRS Report Parameter with 500+ values - reporting-services

One of the parameters I have in my SSRS Report is called Customers. The user wants to be able to select multiple customers from a drop down list. Our customer list is over 500+ entries long. How can I get that many values in a drop down list. For that matter, how many values will a parameter handle? Is there a way to set the drop down list to be able to be typed over to prompt values? An example of that last question would be like how on most forms that ask for the state you live in, you can click on the list and type "TX" and it will move down to Texas instead of having to scroll down. I hope that makes sense. Thanks for all your help in advance!

You cannot have the parameter's field to behave with Autocomplete text.
And I agree that having 500 values in small field is not user friendly.
My suggestion is to split the parameters into 2-4 different parameters (in order to make the customer search more easy), each parameter will have the customers name according to the ABC (for instance the first params will contains the customer names from A-I,second J-R,last S-Z)
If so, your query should look like the following:
SELECT customerName,customerAddress,customerCity,...
FROM customerTable
WHERE (customerID IN (#customerParam1) OR customerID IN (#customerParam2) customerID IN (#customerParam3))

I don't know the how to do the second part with typing in a value but I can help with how to setup the drop down list. First write a query that selects the customer name and unique value for the customer.
Example:
SELECT CUSTOMER_NAME, CUSTOMER_ID
FROM CUSTOMER_TABLE
Then add the parameter and select your data type and the check box that says "Allow multiple values". Then in the properties click the "Available Values" tab. Once that opens select "Get values from a query" and select the the query you just wrote. Once that is selected go to the "Value" field and select the unique value from your query and for the "label" field select the customer name and they should all show up.
When using the values from the parameter in your main query you will need to make sure you use the IN function and not =. This is because you are not getting just one value back but all of them at once.
Example:
SELECT CUSTOMER_NAME,CUSTOMER_ADDRESS,CUSTOMER_CITY,...
FROM CUSTOMER_TABLE
WHERE CUSTOMER_ID IN (#CUSTOMERNAMEPARAMETER)
The name of the parameter is what variable name you need to use.
Also just another tip you can have them all default to selected by going to the default values and select "Get values from a query" and select your query and unique value again.
Also I don't think there is an issue with a number of items limit on the list box. I've had it up to almost 1,000 and had no issues.

Related

Create multiple records from a single record, with one field based on a second table

I'm completely new to creating MS Access databases, so please bear with me while I ask my (probably silly) question.
I have a table for commodities that also groups them into CropGroup and Class, and every commodity would also be considered 'Any food'.
Commodity table:
I would like to add one entry (maybe in a form?), with fields like 'Country' 'Commodity' 'Metal' 'Limit' with all fields identical other than the commodity. Rather than entering these manually for each commodity, is there a way that I can specify the country, metal and limit, select 'Fruit' or 'Anyfood' to automatically create a record for each commodity associated with these terms, so it looks similar to this? Doing this would save me hours if not days of work in the long term.
Output table:
Any suggestions or pointers in the right directions would be much appreciated!
Cheers,
Sophie
You can set default value for text or comboboxes in data entry form.
So, you will set default value for each text box individually. When you you will run the form, text boxes will fill with default values automatically. If need you can then change values as per your need. As per my above screenshot, when you run the data entry form it will look like-
If anyone comes across to this question later, I was able to solve this perfectly with a relatively simple SQL query in the end:
INSERT INTO MetalLimits ( Country, Commodity, Element, [Limit(mg/kg)] )
SELECT Country, Commodity, Element, [Limit(mg/kg)]
FROM (SELECT Commodity FROM _CommodityList
WHERE (([_CommodityList].CropGroup) Like [Enter CropGroup] & "*") AND
(([_CommodityList].Class) Like [Enter Class] & "*")) ;
This allows manually entering Country, Element and Limit(mg/kg) as per the table rules (for MetalLimits table) in separate prompt pop-ups, and select the commodities based on the pre-defined CropGroup and Class (from _CommodityList) in another pop-up.

Access - Enter Parameter Value Error

I have a table that contains all the weeks of the year (using the client's numbering, so Week 1 is in June), and the dates they start. There is a form where they can choose which week they want to look at, so I've used a ComboBox that grabs all the week numbers for which they've entered data in the WeeklyHours table, using
SELECT Format(WeeklyHours.Week,"0") AS Expr1 FROM WeeklyHours GROUP BY WeeklyHours.Week;
This combobox is then supposed to be used as the week filter for a couple queries I've built, using the combobox value as the matching criteria. The problem is that when the form is closed, those queries can't run, and give me the Enter Parameter Value error for the combobox value.
To fix this, I tried to create a new table called SelectedWeek with a single entry called Week_Number. There is then some AfterUpdate code that saves the selected combobox value to the Week_Number field of SelectedWeek.
I then changed the queries to point to [SelectedWeek]![Week_Number], so that the queries will always use whatever the most recently selected week was.
However, I keep getting the Enter Parameter Value error for SelectedWeek!Week_Number, and I can't figure out why.
Any help would be most appreciated.
Thanks,
Joel
Reason the user is prompted for Parameter Value (by the way, it is not an error) is in both cases the Access SQL engine cannot see either referenced values. In first case, the form is closed and in second case column is not properly aligned to a lookup.
In first scenario, simply keep form open which user selects value from combobox when running other queries. Otherwise, all content on form is not callable since it is closed from memory:
SELECT * FROM TableName WHERE weeknumber = Forms!FormName!WeekNumber
In second scenario, use a DLookUp() part of the Domain Function Family.
SELECT * FROM TableName WHERE weeknumber = DLookUp("Week_Number", "SelectedWeek")
And really, domain functions can be generalized as subqueries in SQL:
SELECT * FROM TableName
WHERE weeknumber IN (SELECT Week_Number FROM SelectedWeek)
Even more, you can run a cross join query (tables separated with commas in FROM clause) of the two tables and avoid lookups. Below assumes SelectedWeek is a one-row, one-column table but with the WHERE condition, length is handled and you can explicitly declare columns in either table:
SELECT *
FROM TableName, SelectedWeek
WHERE TableName.weeknumber = SelectedWeek.Week_Number

How can i run the report without specifying the parameter value in SSRS

H, I have a parameter 'Client' as drop down in SSRS report. My requirement is to select all the records for all the clients if i don't select any parameter value and if i select particular value in the drop down,i need to display records for the that particular client.
I am getting the list of clients as a input from query.How can i add option select all by default.
Thanks in advance
You can do this a few ways...
Check the "Allow Multiple values" on the general tab of the Parameter Properties, go into the Available values and select the dataset you are using to get the values, make sure the the column that contains the actual data to search on is what you select for the VALUE field...(with this one - make sure your query eliminates the NULLs for the Value field) then you will have a drop down with all the values and it will add Select All...
Then in the Default Values tab, you can hook to the same query and select the VALUE field again... (as long as there aren't any NULLS) You may need to do tweaking depending on your query and values...
or
You can check the "Allow Null Value" on the General tab in the Parameter Properties, then in the Default Values - select "Specify Values", then Add, and (null) pops in there automatically...
Then call a stored procedure where the parameter defaults to NULL and if you pass NULL or don't pass in a string of values, your query will return all (not sure how you'd implement this if your query is embedded in the report... I try to do all of mine in Stored Procedures..)
Add "All" to the results of the query that returns a list of clients for the drop-down and make it the default selection. Then handle it in your main stored procedure that if "All" was selected, you don't filter by clientId, and just get all clients.

how to create a multi field query in access 2007?

guys
' i am beginner in access 2007 and i want to create a form that contains many fields (product id, product name, etc and date of transaction) and use a query to search for data
in other words for example i want to enter in this form a date range i.e from 1/1/2013 to 1/03/2013 and search for product x ( attention ) my basic table contains only date of transacton field and not the from, to fields ( the from , to fields i want only to add them in the search form and them to search based on the value or date of transaction field ) please help me
Short but sweet answer;
Create a new "Query" using the GUI. Add your table to the top part. Double-click columns in the table to add them to the output of the Query.
Next, in the query conditions (grid below the name of each field) use brackets "[]" around your from/to dates. E.g. the query condition underneath your date field may be;
"between [MyStartDate] and [MyEndDate]".
Now "run" the query to test it; Access will prompt you for 'MyStartDate' and 'MyEndDate'.
Finally; if you save this query and set it as the "Data Source" for a Form, you may alter the above condition slightly to pull the values automatically from the form itself, so that you are not prompted every time the query runs. E.g. this condition may be;
"between Forms![MyTableForm]![MyStartDate] and Forms![MyTableForm][MyEndDate]".
You will have to play with it a little, but those are the basics.

Autocorrect in combobox

Edit: I have one column in the table. For example its call "Title". This column has a combobox that has list of items like "Best In Show", "Best In Group" etc. I want to select one of the following drop-down list of items was a different text. For example: I have selected "Best In Show" but in column its should looks like "BIS!"
Of course that other text that will replace the original in the drop-down list is also known that I can post in SQL-query or in macros or in other tables or elsewhere
Let me know if you need more info. Thanks.
Use as the record source for the combo a table/query/value list with two columns, the first with the abbreviation, the second with the display value.
Set the number of columns in the combo to 2, and set the Column Width of the first column to 0.
This will then show the display value for the actual value in the database.
Also see the last answer MS Access Dropdown List/Combo Box
Let's say you have a Film (ID, Title, Abbrv) table and a Person (ID, Name) table.
And you also have a union table Person_Film (PersonID, FilmID)
For the union table, Person_Film, you'd like to select a person based on his/her name, and a film based on its title, but you'd like to see the abbreviation instead.
What you do is to use the Lookup wizard on your Person_Film.FilmID field. You do so by choosing "Lookup wizard..." instead of a data type when in design view for the forementioned table and field and choosing the first option, "I want the lookup column to look up the values in a table or query"
If the wizard complains saying that there exist a relationship based on that field, just go to the Relations screen in the Tools menu, delete the relation (look for the field in the table) and retry. Don't worry: The wizard will re-create the relation in the end.
You select the Film table as row source, and select ID, Abbrv and Title (in that order). Leave the option to hide the key column checked, as recommended.
The result is something like this: