Custom Report: Custom 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
IFa rule exists on this lineELSEif no rules above match, use this result$value_typevalue type name$emptyspecial handler for empty values==equals!=does not equalANDlinks multiple conditionsTHENresult 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.
Custom Logic Value Type | Custom Logic Value Type | Payroll | Job | Timesheet | Invoicing |
|---|---|---|---|---|---|
Standard fields
datefinish_timefrom_datehourly_ratehourly_rate_adjustedpdrst_hourshoursjob_notesrate_autoselectrate_typerate_type_textrolestart_timestart_time__finish_timeto_datetotalunit_rateunitsunits_autoselectunpaid_breakrow_splitsubmitted_lateunpaid_break_start_timesunpaid_break_end_timesmultiplier
Association fields
absence__codeabsence__commentabsence__nameblock__codesblock__costing_codeblock__namesblock_name__task_nameclient__codeclient__costing_codeclient__divisionclient__subdivisionclient_name__location_name__block_namecosting_codecosting_code__task_codeemployee__divisionemployee__emailemployee__full_nameemployee__recruitment_typeemployee__staff_idemployee__subdivisionemployee__groupsjob__leader__full_namelocation__costing_codelocation__divisionlocation__subdivisionlocation_name__block_name__task_nametask_category__codetask_category__nametask_code__codetask_code__name
Costs
base_costtopups_costpdrst_costperformance_bonus_costProportion of total performance bonus earned, applied to this timesheet
performance_bonusPerformance 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_costadditional_costovertime_costtotal_costcost_per_unit
Other fields
custom_logicrow_namerow_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_typewill be one of:summarytimesheet_entryabsence
row_namecan be one of:paid_rest_breaktopupcontract_hourshourly_hoursperformance_hourstotal_hoursordinary_hoursovertime_hoursIf multiple overtime rates, then these will be in the format
overtime_hours_RATE, for exampleovertime_hours_2.0
days_workedpay_contract_summaryagreed_hours_topupminimum_earnings_topuppay_performance_summaryperformance_bonusabsence_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 $unit_rate == 1.5 THEN piece rate+_+$unit_rate
If the row’s unit rate is 1.5, then concatenate text with “unit rate”
Example result: “piece rate_1.5”
Example 3
IF $row_name == topup THEN $total
IF $row_name == paid_rest_break THEN $hours
IF $row_type == timesheet_entry AND $rate_type == contract THEN $unit_rate
ELSE $hourly_rate
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 $location__division != $empty THEN $location__division
IF $client__division != $empty THEN $client__division
IF $row_type == timesheet_entry THEN No Division
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