I have a crystal report that has data grouped by employee like this:
Employee 1:
-Name
-Orders written
-Etc
The report displays all this information. but what I want to do is make a list that is only the employee and when clicked on will drill down to the info. Even better would be is there a way to make a drop down to select employee?
The report is created from a sql query command with parameters for date to get the amount of orders.
Crystal Reports has DrillDown functionality. Maybe this will help. https://msdn.microsoft.com/en-us/library/ms227343(v=vs.80).aspx
Related
I currently have a database in MS Access that I need to update the way we generate form letters.
We use a query I made 10 years ago to generate certificate of attendance letters.
SELECT doctors.address, seminar_title, seminar_date, first_name, last_name
FROM doctors, seminars, registrations
WHERE seminars.seminar_id=[Seminar] AND registrations.seminar_id=seminars.seminar_id AND
registrations.dr_id=doctors.dr_id
ORDER BY doctors.last_name;
The result is a set of letters for whatever seminar ID you enter. Each letter representing an individual registration by a doctor.
The issue now is that we have an additional table (Licenses), and I need each letter to display 1 to 5 licenses that a doctor might have.
The fields in the Licenses table are: license_ID, doctor_id, license_type, state, and license_number.
I can display one license, but getting a varying amount of license numbers and states to display, each matched on a letter to its licensee, has been beyond what I know how to do so far.
Any input is appreciated.
You'll want to create a subreport listing all of the licenses for the doctor the letter is addressed to. First you will need a table linking doctors to the licenses they have (e.g. "doctor_licenses"), with the fields dr_id and license_id. Add doctors.dr_id to your query above so it is part of the recordsource for your main report. Then create a second report to display the licenses for each doctor. The recordsource for your second report will be something like
SELECT dr_id,
license_type
FROM doctor_licenses
INNER JOIN licenses
ON doctor_licenses.license_id = licenses.license_id
Add the second report to your main report as a subreport. Link the subreport to your the main report by setting its "Link Master Fields" and "Link Child Fields" properties both to dr_id. More info on subreports and how to create and use them here:
https://support.microsoft.com/en-us/office/create-and-use-subreports-816f987a-4615-4058-8f20-ce817093bb33
EDIT because I can't comment on your original post, you'll still need to use a subreport to list doctor licenses as there is a one-to-many relationship between doctor and licenses (one doctor can have one or more licenses). If you're trying to add the list of licenses as a comma delimited list or something similar to your report you'll have to utilize a more complicated approach. Please look at the subreport solution and if that doesn't do what you need please be more specific about your requirements.
I have an RDLC report which sums totals for each group in VB.Net. It is working fine but what I want to do is to add a figure outside the group to only a particular group based on users selection.
Assuming there are three groups: Food Dept, Security Dept and Sales Dept. I want a figure 2000 to be added to only the Food Dept without affecting the Sales and Security Dept. Any help?
You can use an expression like this:
=Sum(Fields!ValueToSum.Value) + IIf(Fields!Departments.Value = "Food Dept", 2000, 0)
This is a simple example: use ReportParameters instead of constant ("Food Dept", 2000).
I would add a parameter and assign the value. An integer parameter for ex: #FoodDeptOffset can be added to the fields as
=Sum(Fields!FoodDept.Value) + (Parameters!FoodDeptOffset.Value)
Thanks A lot for the answers. I was able to sort it out by passing a parameter which did the trick. On the main form which loads the Reportviewer I attached A combo box giving the users an option to select which field the wanted to add to and the passed it as a parameter to the rdlc report.
Been rattling my brain for a while and I could not get pass how to do the SQL query that will show the relationship/connections between my two tables.
I'm working on an IT equipment inventory program. I have two tables;
SELECT serial_number, model, ship_dat, status FROM items_list
SELECT item_serial, connected-to_serial FROM connections
All items like desktops, laptops, monitors, etc are on the items_list table. To track down the relationship/connections of the items, I created the connections table. IE, Monitor with serial_number=Screen#1 is connected to a Desktop with serial_number=Serial#1. It works ok with my Window Form application because I
used a datagridview control to list all devices simple SQL query.
However, when trying to show the relationship/connection on SQL Reports I've ran out of ideas how to do it. I'm aiming to get the report look like below or something along the lines. I just need to show the connections between the items.
Thank you
You should be able to do this with a table in SSRS if that is what you are using. The query you would need to drive the table of all related items would be:
SELECT item_serial, connected-to_serial, mainItem.*, connectedItem.*
FROM connections
INNER JOIN items_list mainItem ON connections.item_serial = items_list.serial_number
INNER JOIN items_list connectedItem ON connections.connected-to_serial = connectedItem.serial_number
You can of course tailor the SELECT statement to your needs, mainItem.* and connectedItem.* will not give you the most descriptive column names. Using column aliases (found under column_alias here) you can give a more descriptive name to each column.
From here you should be able to use a table and create a row group on the main item (either name or serial number) to get the type of look you are looking to achieve here. I believe the Report Wizard actually has most of the functionality you are looking for and should handle the bulk of this. You may have to move some of the cells around to get the look you are going for though.
I have a timecard file that list the daily hours for each employee. I have figured out, using a query, how to get the total number of hours but I also need the total number of employees. I have searched here and on other places and tried just about everything and nothing works. I am sure it is something pretty simple but I just cannot seem to get the total number of employees. Any help will be greatly appreciated.
The main file is called Timecards and I link to a file call Employees using the field employee number to get the employee name. There are other fields in Timecards namely "Job No", "Job Description" and "Type of Hours"( such as regular and overtime) that I wanted on the summary report but I did not realize that a employee could have two entries in those fields. So that is why I could not get the total employees to come out right when using those fields.
I was finally able to create a query and print a report with the total employees using fields that only appear once in the Timecards file. So unless someone knows how to count total lines is a report I will stick with the report I have that works.
I agree with Vladimir, it helps to post what you expect to see and what kind of tables you are working with. However, I have been in the same situation. Maybe this is a good starting point in SQL
SELECT COUNT(*) AS TotalNumberEmployees FROM TheTableShowingEmployees;
Posting a question with:
A problem statement
A list of expected results
Sample Code tried
Table structures involved (Including relevant fields, data types, and tableNames)
Will get you better results. Show your work, we'll show you ours!
Given limited information so far this is the best I can come up with
I use a left join incase some of the employees haven't reported hours yet and you want all employees.
I use coalesce to change null hours to 0.
I assume that Employees Table exists and it joins to timecard on Employee_no.
I assume firstName and LastName are in the
employeetable
.
SELECT coalesce(Sum(T.hours),0) AS SumOfhours, E.FirstName, E.LastName
FROM Employees E
LEFT JOIN Timecards T
on T.Employee_no = E.Employee_no
GROUP BY E.FirstName, E.Last_name
Also note you can edit your question don't comment on it; it makes it difficult to follow.. and last but not least .... Welcome to SO!
Well after much searching and testing I finally found a post from 2009 that took care of my problem.
`If you want to count groups, you might need to add a running sum text box in
the group header. For instance, if your report contains orders and order
details but you want to count the number of unique orders, you can't use a
text box in the report footer with a control source like:
=Count(OrderID)
This expression will count orders and details.
You can add a text box in the Order header:
Name: txtOrderCount
Control Source: =1
Running Sum: Over All
Visible: No
Then add a text box in the Report Footer section:
Control Source: =txtOrderCount
Duane Hookom
Microsoft Access MVP`
Thanks for all the help.
i have a database used at work for evaluating calls, the database is somewhat dated and originally created on Access XP. Once evaluated these calls are given a score out of 5 which is entered along with other data (such as date, employee name, etc) on a form. I have the reports set up so they generate when you enter the employee name and then the start of a date period and the end of a date period, the report will then generate and show the entries made between those 2 dates. i am trying to include a section on the report which shows an average of the call score for the employee for the period chosen. I understand this may be pretty simple but i'm struggling! cheers, Kris
If you want to work out group calculations on reports, you can either put them in the group header/footer, or report header/footer (for calculations over the whole report).
In this case, placing a textbox with something like =AVG([CallScore]) as the control source in the Report Footer should work.
This page should explain more about using aggregate functions in reports: http://office.microsoft.com/en-gb/access-help/summing-in-reports-HA001122444.aspx