How to specify available values for drop down menu - reporting-services

I am writing a SSRS report which prints the instructorid and instructor full name but for the selected criteria. For the report, I have to prompt a drop down menu. In available values section I chose specify values and added all the four labels
Parameter Drop Down
Instructor Type:
SYSTEMS, SOFTWARE,CYBERSECURITY,DATABASE
Criteria
if SYSTEMS is selected – instructor ID like ‘SYS%’
If CYBERSECURITY is selected – instructor ID like ‘SEC% or ‘MAL%’ or ‘CYB%’
if SOFTWARE is selected - instructor ID like ‘SOFT%’
IF DATABASE is selected - instructor ID like ‘DATA%’
Query:
select instructorid, fullname
from instructor
where instructorid like selected criteria
Result Query if SYSTEM is selected
select instructorid, fullname
from instructor
where instructorid like 'SYS%'
Question:
If CYBERSECURITY is selected – instructor ID like ‘SEC% or ‘MAL%’ or ‘CYB%’
How do I add these values for my available values without creating another label?

You don't need to add more available values to accommodate the various instructor IDs. You'll need to adjust the query to handle it. For example, part of your WHERE clause would look like this:
WHERE (#Parameter = 'SYSTEMS' and instructorid like 'SYS%')
OR (#Parameter = 'CYBERSECURITY' and (instructorid like 'SEC%' OR instructorid like 'MAL%' OR instructorid like 'CYB%'))
You can continue this structure to add more options. Watch your parentheses to make sure the logic holds up.

Related

Drop down source issues for Apex Form

I have a table I created to use as the source for the of dropdowns of a form. The goal is to have only what possible options are available for the Department code based on who the owner is. I got the scrap owner to display correctly but unfortunately I have not been able for the department code to show up. No options are able to pop up. This is what my code looks like:
Select DEPT_CODE, DEPT_CODE as Value From Degrade_Robots
WHERE SO_NAME = :P7_SCRAP_OWNER
group by DEPT_CODE
order by DEPT_CODE
My table is set up like:
You aren't aggregating anything; don't use group by but distinct.
select distinct
dept_code as display_value,
dept_code as return_value
from degrade_robots
where so_name = :P7_SCRAP_OWNER
order by dept_code;
As you don't see anything in the list, I presume that's because you forgot to mention P7_SCRAP_OWNER item in Select List's LoV Parent Item(s) property.

How to store multiple value in one available value in SSRS reporting

Currently i wanted to search multiple value in one available value which configured in SSRS.
Now user required to click one by one to filter their report as per below.
enter image description here
However they requested to group red highlighted into 'CCB KV' and green highlighted into 'CCB N' therefore instead user click one by one and they can directly click 'CCB KV' to filter those red highlight.
Currently we expect to use the available value option below to create 'CCB KV' and store those red highlighted and not require any script change. However it seems like available option only allow single value to store instead of multiple value and the query is using where clause as 'ce.branch_code in (#branchCode)' to obtain the result.
enter image description here
Seek you advise whether available value able to store multiple value.
The easiest way would be to add a table to your database containing the relationship between the parameter value and the values you actually want to search for.
For example you could create a dataset with the following in your dataset query.
CREATE TABLE myLookupTable(AreaName varchar(50), LocationName varchar(50))
INSERT INTO myLookupTable VALUES
('Area ABC', 'Tower A'),
('Area ABC', 'Tower B'),
('Area XYZ', 'Tower X'),
('Area XYZ', 'Tower Y')
For you parameter list you could then create a dataset in your report something like
SELECT DISTINCT AreaName from myLookupTable ORDER BY AreaName
Set the available values of your parameter to point to this dataset.
Then in you main dataset, just add a join in to this new table
SELECT a.* FROM myMainTable a
JOIN myLookupTable b on a.LocationName = b.LocationName
WHERE b.AreaName IN (#myParameterName)

MS Access - Cascading 2nd Combobox Not Cascading

On a form called opportunity I have a combobox called cmbCompanyName to select a company name from a table called Company. This is the first part of my cascade.
The cmbCompanyName has three columns.
Col 0 is the CompanyID, which is hidden.
Col 1 is the CompanayName, which is populated to the form
Col 2 is the CompanyCity, which is populated using a different part of the form using the control =[cmbCompanyName].[Column](2)
All of this works correctly.
The second part of my cascade cmbPoCLastName looks at another table called Contacts and should take the CompanyName from cmbCompanyName to filter my choices.
cmbPoCLastName uses the following query
SELECT Contacts.Company, Contacts.[Last Name], Contacts.[First Name], Contacts.[E-mail Address], Contacts.[Business Phone]
FROM Contacts
WHERE (((Contacts.Company)=[Forms]![Opportunity]![cmbCompanyName]));
To support my cascasde, cmbCompanyName requeries cmbPoCLastName upon update.
Private Sub cmbCompanyName_AfterUpdate()
cmbPoCLastName.Requery
End Sub
All of this result in nothing showing up in the second part of my cascade.
I believe the issue is cmbPoCLastName is filtered by the hidden CompanyID. I cannot figure out how to force this query to look at the company name vs. the ID number.
Thanks.
Based on the first comment made by #June7, I reworked my tables to use CompanyID to related them to one another. I had previously used CompanyID in some tables and CompanyName in others.

Searching a database in Report Builder 3.0

I am not sure if this is possible in Report Builder or not. I want to put a text box in a Report Builder report and then search the database for a specific person and display that in a subreport. Is this possible and, if so, how would you suggest I do it? I have tried researching it online without success.
This part will produce a parameter into which your user can type whatever they want
You need to set up your report to use parameters. You can set these parameters up to require user input either from manual entry or by picking from a pre-defined list.
Assuming you are returning your data using a SQL query, you can then reference these parameters in your dataset script. If for example you had a parameter called FirstName and another called Surname, and you only wanted to return values in your data set that matched both exactly, you would reference these parameters like so:
select PersonID
,FirstName
,Surname
,OtherDetails
from PersonTable
where FirstName = #FirstName
and Surname = #Surname
If you would rather have more of a 'search' type function, you can use the SQL like operator and wildcards, though bear in mind this will have a potentially very detrimental effect on your query performance:
select PersonID
,FirstName
,Surname
,OtherDetails
from PersonTable
where FirstName like '%'+#FirstName+'%'
and Surname like '%'+#Surname+'%'
This part shows you how to change that parameter so it provides a drop down menu. This part is optional.
If you want to provide a list of available options to select from, you can create a parameter that has a list of 'Available Values'. These can either be manually typed in by yourself - hard coding them in to the report design - or you can make them data driven by basing the parameter on a second dataset.
To get that list of people, you would want to return the ID of the person you are looking for as well as the details that are end-user friendly to be visible in the report:
-- select distinct so we have no duplicates
select distinct PersonID as Value -- Value is what is used to the query. This ideally will be a uniquye identifier
,FirstName
+ ' '
+ Surname as Label -- Label is what the user sees. This can be a bit more verbose and detailed
from PersonTable
order by Surname -- Specify how you want the options ordered
,FirstName
If you set this dataset as the source by selecting Get Values From A Query in the parameter options, you will see the drop down list appear when you run the report. Users can then select one, click Run Report and have their selection impact the data that is returned.

MS ACCESS - Adding items to Lookup Tables from a Master Query

A seemingly simple question that has me stumped.
I have a table [Inventory] with the following fields: [Category], [ItemName], [Price].
ex: "Plumbing", "ACME Showerhead", $43
I have a table [Categories] with the fields [Category], [SubCategory]
ex. "Plumbing", "Hardware" or
ex. "Flooring", "Wood"
I wish to have a form (ideally a standard grid) that allows me to enter new Inventory Records.
On this form would be the fields Inventory.Category, Categories.SubCategory, ItemName, Price.
When navigating to the field Inventory.Category, a drop down should allow me to select from Unique Categories.Category values. Once selected, the Subcategory field should allow me to select from valid subcategories of that Categories.Category. For example, if I chose "Plumbing" in the category field, I would only be presented with teh subcategory "Hardware" and not the subcategory "Wood".
I would also like the ability to add new Category Records while in this form, so I am not limited to whats in the dropdown. So for example, when adding a record to Inventory, if I want to create a new Category/SubCategory pair of say, "Plumbing", "Pipes", I should be able to do that without having to switch to another form/table or whatever.