SSRS formatting several records in on line - reporting-services

I have an employee database table that has the times that every employee went into work or went for break. The table has a record for every time a employee signed in or out like this:
Name   | Type        |  Date
john sil  |  ClockIN    |  10/11/2020 9:00 AM
john sil  | BreakIN     |  10/11/2020 12:00 PM
john sil  |  BreakOut  | 10/11/2020 12:30 PM
john sil  | ClockOut   |  10/11/2020 5:00 PM
I would like to group those records in one to appear all in one line instead of four. Something like this:
Name    |  Date  |   ClockIn  |  BreakIn  |   BreakOut  |  ClockOut
John sil  |  10/11/2020  |  9:00 AM  |  12:00 PM  |  12:30PM  |  5:00 PM
Any help will be appreciated. Thanks in advance.

A Matrix in SSRS was made for this kind of data.
Add a Matrix to your report.
In the Grouping Window, go to Group Properties. Add a Grouping to the Row and Group On Date without the time. Sort by the date expression.
=Format(Fields!Date.Value, "yyyy-MM-dd")"
This will combine all the records for a single day.
Use the Date field for the Cell value and use 'mm/DD/yyyy' as the Format Property of the Date text box.
Right Click on the RowGroup and Add Group -> Parent Group.
Group on Employee and Sort by Employee. Use the Name for the Text Box value. This will break up the days by employee.
Click on the Column Group in the Group Window and go to Group Properties. Group On Type.
Go to the Sort tab. Add a Sort By
=IIF(Fields!Type.Value = "ClockIN", 1, 2)
This will make the Clock In come up first.
And then add a second level by Fields!Type.Value. The sorting by name will work for the other Types. The Column grouping will break up the daily data by the different punches.

Related

Find next available time slot in "calendar"

I have the following MySQL tables:
ServiceProviders- id, ...other irrelevant columns
ProvidersWorkHours - id, providerId, day(enum[1,2,3,4,5,6,7]), startTime(time), endTime(time)
Service- id, duration, ...other irrelevant columns
Groups- id, serviceId, providerId,size, duration
GroupReservations- groupId, customerId.
ServiceProviders have their own workHours (when they're available to work), they can create Groups of different sizes and of different durations (they can be longer or shorter than regular service duration). I need to find next available time slot for regular service duration that is not reserved or a group still not completely filled (for example group of size 2 that has only 1 reservation is a valid one).
Expected outcomes:
Current date: 2022-06-20 18:24 (MONDAY)
Regular service duration: 45 minutes
Provider workHours: [MONDAY 08:00-17:00, TUESDAY 08:00-17:00, WEDNESDAY 08:00-17:00]
Some expected scenarios:
We have new provider, with no groups, no reservations. Expected nextAvailableSlot 2022-06-21 08:00
We have only one full group at 2022-06-27 12:00. Next availableSlot still should be 2022-06-21 08:00
We have group of size 2 that has only 1 reservation at 2022-06-21 08:00. Next available slot should be 2022-06-21 08:00
We have full groups till 2022-06-21 16:00 (last one ends at 16:00). Next availableSlot should be 2022-06-21 16:00.
As I was thinking we can't go through solution that I found in other places (join same reservations table with itself, in my case it would be groups). It's bad since I can have no groups, or my first group a week ahead of currentDate. Probably what would work is to take currentTime and keep adding regular serviceTime and check all the constrains, until it does not intersect with any reservations, or until it find a group that isn't filled yet. Not sure how to do it in MySQL, though. Any ideas or other solutions?

conditional formatting by date

I have the following table in my report
Address SeenDate
stack street 2015-01-02
over lane 2016-03-15
flow way 2017-05-12
I would like to highlight addresses in green that have got a 'SeenDate' within 12 months, I think this will need to be a rolling 12 months. So from the table above 'flow way' will be highlighted in green.
To do a conditional on your date value to highlight records that are within 12 months of the report execution date, you can compare the date value with a year ago from today using iif in the Fill expression of the textbox:
=iif(Fields!SeenDate.Value >= Today().AddYears(-1), "Green", "Red")
Also a note to add that Today gives you the date for today and Now gives you the date and time of right now, depending on how precise you want to be.

Get records from NOT EXISTS and IN subquery

I have a query that needs to perform the following: Get all attendee accounts that do not have meetings scheduled during the following dates and times.
You can run samples here. I already have a date and two times added in the URL.
In my above link results you'll see Alex Hendry listed. He has a meeting at 11:00. Since I am getting only times at 11:30 and 12:00 his name appears. However, if I change the times to 11:00 and 11:30 his name does not appear; I understand that since 11:00 falls into the conditions he shouldn't appear.
How can I change my above query to return Alex Hendry for the 11:30 availability?

How to get the Year in between two dates

I have
leave table
EmpNo
EmpName
LeaveStart
LeaveEnd
I want to show the leave taken by year and i used datediff(dd,LeaveStart,LeaveEnd)
it will shows the no. of days have taken.
but i want to show yearly wise.
E.g
2014 - 10 days
2015 - 16 days
how & where i can use year function becoz have leavestart & leaveend
suppose if employee taken a leave
LeavStart- 28-Dec-2015
LeaveEnd - 05-Jan-2016
then result should
2015 - 4 days
2016 - 5 days
then how to use query.
please help on this
May be something like this
SELECT Year(LeaveStart),YEAR(LeaveEnd),DATEDIFF(DAY, MIN(LeaveStart), Max(LeaveEnd))
FROMtbl_Subject_OrderAssignedDetails
GROUP BY Year(LeaveStart),YEAR(LeaveEnd)

How do i save a date range on just the months, not year or day ie. January through may

How do I save a date range on just the months, not year or day, for example January through May?
I am to prepare a table of crops and the appropriate time for planting. It needs to be non-specific as to year and day.
Some beans can be planted "January through March" or "August through November".
I need to be able to call up a form and select the month of my search and return a list of what crops are appropriate for the month selected.
Should I create a table with fields crop month
and save data as Beans Jan - March
then another entry as Beans August - November
Or
Beans 1,3 and 8,11?
You can create a separate table to keep track of allowed months for your crops:
create table cropmonths
(
cropid int not null,
allowedmonth int not null
);
So you will have 7 records in that table (one for for each month) that would reference a single "beans" row in crops table.