Custom Report Logic
This is an advanced feature that can break your reports.
If you need a hand to get this set up, please get in touch with us at support@tatou.app.
When building a Custom Report, you set the required columns, and the type of data each column contains. One data type is Custom Logic which allows more complex conditional values.
Custom Logic takes one or more conditional statements to determine which value to populate each cell with. This logic is executed for each row when populating this column.
Syntax
The syntax is specific to Tātou, so may vary from other syntax you are familiar with.
Each rule is on its own line, and each component is separated by a space.
IF {CONDITION} THEN {RESULT}
ELSE {OTHER_RESULT}
Rules can have multiple conditions strung together
IF {CONDITION} AND {CONDITION} THEN {RESULT}
ELSE {OTHER_RESULT}
Accepted elements
IF
a rule exists on this lineELSE
if no rules above match, use this result$value_type
value type name$empty
special handler for empty values==
equals!=
does not equalAND
links multiple conditionsTHEN
result follows+
concatenate with another value type or text
Value types
These variables are available in both your condition, and in your output. Prefix these variables with a $
so they are recognised as a variable rather than plain text.
Standard fields
date
finish_time
from_date
hourly_rate
hourly_rate_adjusted
pdrst_hours
hours
job_notes
rate_autoselect
rate_type
rate_type_text
role
start_time
start_time__finish_time
to_date
total
unit_rate
units
units_autoselect
unpaid_break
row_split
submitted_late
unpaid_break_start_times
unpaid_break_end_times
multiplier
Association fields
absence__code
absence__comment
absence__name
block__codes
block__costing_code
block__names
block_name__task_name
client__code
client__costing_code
client__division
client__subdivision
client_name__location_name__block_name
costing_code
costing_code__task_code
employee__division
employee__email
employee__full_name
employee__recruitment_type
employee__staff_id
employee__subdivision
employee__groups
job__leader__full_name
location__costing_code
location__division
location__subdivision
location_name__block_name__task_name
task_category__code
task_category__name
task_code__code
task_code__name
Costs
base_cost
topups_cost
pdrst_cost
performance_bonus_cost
Proportion of total performance bonus earned, applied to this timesheet
performance_bonus
Performance of the timesheet. Useful for per-timesheet performance comparisons.
Positive when unit rate (converted to hourly) is above hourly rate.
Negative when unit rate (converted to hourly) is below hourly rate.
foreign_cost
additional_cost
overtime_cost
total_cost
cost_per_unit
Other fields
custom_logic
row_name
row_type
Row types
Each row has two further variables that are useful when creating logic based on the type of row we’re working with.
row_type
will be one of:summary
timesheet_entry
absence
row_name
can be one of:paid_rest_break
topup
contract_hours
hourly_hours
performance_hours
total_hours
ordinary_hours
overtime_hours
If multiple overtime rates, then these will be in the format
overtime_hours_RATE
, for exampleovertime_hours_2.0
days_worked
pay_contract_summary
agreed_hours_topup
minimum_earnings_topup
pay_performance_summary
performance_bonus
absence_hours
Examples
Example 1
IF $row_type == summary THEN $hours
If the row is a summary row, then return the row’s $hours
Result: “1.25”
Example 2
If the row’s unit rate is 1.5, then concatenate text with “unit rate”
Example result: “piece rate_1.5”
Example 3
If the row is the top-up summary row, then return the total value (
$total
); otherwiseIf the row is the paid breaks summary row, then return the number of hours (
$hours
); otherwiseIf the row is a contract timesheet entry, then return the unit rate (
$unit_rate
); otherwiseReturn the hourly rate (
$hourly_rate
)
Example 4
If the row has a Location Division, then return its name
If the row has a Client Division, then return its name
If the row is a timesheet entry return the text “No division”
Otherwise, return nothing