Forum Discussion
calculate working hours based on multiple text fields
hi all,
I want to calculate the working hours per employee but the calculation should be based on text fields:
Here an example how the data look like in the DB (with exeption of the last column, this should be calculated)
| person | TypeOfDayMonday | TypeOfDayTuesday | TypeOfDayWednesday | TypeOfDayThursday | TypeOfDayFriday | TypeOfDaySaterday | TypeOfDaySunday | Working hours |
| A | WD | WD | WD | WD | WD | NWD | NWD | 40 |
| B | WD | WD | WD | WD | NWD | NWD | NWD | 32 |
| C | WD | NWD | WD | WD | NWD | WD | NWD | 32 |
| D | WD | WD | NWD | NWD | NWD | NWD | NWD | 16 |
So if a field is filled with WD (working day) the calculation should count this as 8 hours. I of course can create 5 new columns for every typeOfDay and build it like this, but I hope there is a smarter solution without having five column in place.
Hopefully anybody can help me out with this, thanks in advance for a reply!
joep78 , You can create a new column like
if([TypeOfDayMonday]="WD",8,0) + if([TypeOfDayTuesday]="WD",8,0) + if( [TypeOfDayWednesday]="WD",8,0) + if( [TypeOfDayThursday]="WD",8,0) + if( [TypeOfDayFriday]="WD",8,0) + if( [TypeOfDaySaterday]="WD",8,0) + if( [TypeOfDaySunday]="WD",8,0)
2 Replies
- amitchandak
Super User
joep78 , You can create a new column like
if([TypeOfDayMonday]="WD",8,0) + if([TypeOfDayTuesday]="WD",8,0) + if( [TypeOfDayWednesday]="WD",8,0) + if( [TypeOfDayThursday]="WD",8,0) + if( [TypeOfDayFriday]="WD",8,0) + if( [TypeOfDaySaterday]="WD",8,0) + if( [TypeOfDaySunday]="WD",8,0)
- joep78
Helper III
Amit,
Thanks again for a quick response, very helpful again!