Time Sheet Status – Webi Exercise

It seems to be a good Webi exercise (for beginners).

Employees submit weekly time sheets. Each time sheet has time sheet lines. Time sheet line can have one of three statuses: Submitted, Approved and Rejected.

The status of the time sheet is defined by the statuses of the time sheet lines:

  • When for a week one or more lines are rejected the whole time sheet status is “Rejected”.
  • When for a week one or more lines are submitted, there are no lines rejected, but there can be lines approved, the time sheet status is “Submitted”.
  • When all lines are approved the time sheet status is “Approved”.
  • When there are no time sheet lines, the status is “Missing”.

Solution…

Status Code

= If [Status]="Rejected" Then 1
  Else If [Status]="Submitted" Then 2
  Else If [Status]="Approved" Then 3

Timesheet Status

= If Min([Status Code])=1 Then "Rejected"
  Else If Min([Status Code])=2 Then "Submitted"
  Else If Min([Status Code])=3 and Max([Status Code])=3 Then "Approved"
  Else "Missing"