78
Views
4
Comments
merge record in single

Hello All,

My query is something like this,

I have 2 entries on 4th November One is Check In and other is break In.

I want is there should be only one entry of a particular date for example 4th November. and the total break time of 4th November should be reflected in Break Time column on that record.

How can I achieve this?

The first record should display Break Time as 0.1 hr.

please help.

2024-06-11 16-02-22
Nguyen Ngoc Nam

What I know about yours is: 
- you have a dialog storing in a table,

-the table records all the check in and check out in a day

- you get the earliest check in (CI) and the latest check out (CO) to get a day working

- Attendance Hours = latest CO - earliest CI

- working time = sum of all the time between CI and CO

- break time = sum of all the time between CO and CI

So, can you explain what you really need clearly?

UserImage.jpg
Dev Limbachia

hello,

Break Time is not sum of all time between CO and CI, 

For eg.

A user comes to office and does Check In i.e. CI at 9.00 am.

at 1.00 pm the goes to lunch and does Break In i.e. BI.

He comes at 2.00 pm and does Break Out i.e. BO.

Again 

at 4.00 pm the goes for tea break and does Break In i.e. BI.

He comes at 4.30 pm and does Break Out i.e. BO.

At the end he does check out i.e. CO at 6.00 pm

Now data will be 

first check in - 9.00 am

last check out - 6.00 pm

break time - 1.30 hr(total time between BI and BO)

attendance hour - 7.30 hr (total time b/w CI and CO excluding BI and BO).

this is what I want.

2021-09-06 15-09-53
Dorine Boudry
 
MVP

I think all you have to do is 

  • substract sum checkin from sum checkout times of a single day (A)
  • substract sum breakin from sum breakout times of a single day (B)
  • time worked is A - B

This might be possible in a single aggregate, but we'd need to know some more

* what is your datamodel ?  we can see your efforts at some grouping in an aggregate, but it is not clear from your picture how all the events are stored in an entity.  Is there a separate entry for each event, or is the Checkout time added to the same record as the checkin time for example.  Same question for breakout vs breakin.

So if a person comes to work and has 2 breaks, like your example, are there 3 or 6 rows in your database ?

*Also, is it possible to go across midnight with any of these time frames, and of so, what are your business rules as to what day it should be reported as ?

*Also, is it possible your data has gaps (forgot to checkout), and what are your business rules for making calculations in this case ?

Dorine

2022-08-03 04-32-50
Ravi Punjwani

Hi Dev,

First of all I would simplify the filter conditions in the aggregate.

Remember that any AND clauses in a single filter clause doesn't seem right. If you want to have an AND clause, then just add another filter in the list. This will simplify your logic and make it more readable. All the conditions in the filters would internally translate by merging with AND operators.

If the data size expected is not too big to cause any performance issues, it would be easier to do the grouping and merging of your data into custom fields in a separate action after you fetch your data from the entities. Meaning you can simply fetch your raw data that you're going to use, then using a loop iterate them separately and create a new data list (with custom structure as you may need) to address your specific requirements. If only the original data list is too long to be processed in a seprate loop, then you must look for grouping or aggregating your data inside the Data Aggregates only (or Advanced SQL).

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.