Time clock systems by TimeIPS
Call Now! 316-264-1600
Knowledge Base Search:  
Main Menu
· Home

· Table of Contents
· Article Index

· Downloads
· New Features
· News
· Web Links

TimeIPS Knowledge Base

Table of Contents: Article IndexPrintable Version

Allocations and Job Allocations in Reporting

Allocations allow you to create custom codes and amounts that are associated with time events. Job allocations are similar, but specific to a job. The "duplicate this row" and dynamic job allocation mapping functions provide a way to split the hours of an event over those allocation amounts.


Duplicating Rows:

  • This first method allows us to dynamically create extra rows in the report through the use of a magic string similar to action_remove_this_row but it is of the form action_duplicate_this_row(1,2,3,n). When the report is processing, after expressions are evaluated, if our row has data of the form:

  • "Jacob", "XYZ," "action_duplicate_this_row(1,2,3)"

  • This will modify the existing row and create additional rows like this:

  • "Jacob", "XYZ," "1"
    "Jacob", "XYZ," "2"
    "Jacob", "XYZ," "3"

  • There can be any number of comma separated values passed to action_duplicate_this_row. If the string appears more than once such as

  • "Jacob", "XYZ," "action_duplicate_this_row(1,2,3,4)", "action_dupliate_this_row(a,b)"

  • Then we will create as many rows as needed to satisfy the longest list and fill others with blank. Our output will look like

  • "Jacob", "XYZ," "1", "a"
    "Jacob", "XYZ," "2", "b"
    "Jacob", "XYZ," "3", ""
    "Jacob", "XYZ," "4", ""

  • Also, the duplicate string is able to appear along side other parts in the string and our duplication will only replace the appropriate pieces. So if my row after expression parsing looks like this (two magic strings in one column)

  • "Jacob", "XYZ," "Amount: action_duplicate_this_row(1,2,3) Code: action_duplicate_this_row(a,b,c)"

  • The output should be

  • "Jacob", "XYZ," "Amount: 1 Code: a"
    "Jacob", "XYZ," "Amount: 2 Code: b"
    "Jacob", "XYZ," "Amount: 3 Code: c"

  • This magic string is long enough that it won't naturally occur in other results, but can be a bit of a handful to add to expressions. To ease this issue we created the following function:

  • duplicate($list)

    that can accept either a comma separated list or an array and will parse either into the proper format and return the magic string.



Job Allocations:

The report writer no longer needs to know exactly which job allocation codes to look for ahead of time with the use of the following dynamic job allocation mapping function:

jobAllocationList($key, $delimiter=',')

key can be any 'code', 'amount', or 'note'.
delimiter will default to a comma but can be any string to define a text delimiter between values or can be NULL to make the return value be an array.
The function will return the appropriate values for the designated key for any job allocations used on this event.



Array Mapping

To prevent the jobAllocationList('amount') from just returning a list of the percentage values designated for the splits such as 50,25,25, we'll use a function similar to php's array_map that will divide each of these numbers by 100 and multiply it by the duration. The following function

listMap($list, $expression)

will take each value in list, call it listMapValue, add it to the row's data and evaluate a new expression with it. The idea is that you can then do things like this

listMap( jobAllocationList('amount'), {{ [duration]*[listMapValue]/100/3600 }} )

The expression has to be passed in with double curly braces to signify the start and end of the expression. This is so the expression engine will know to not attempt to process any of the pieces of that new expression until its time.
If you pass $list as a string then you will get a string back with the modified values. If you pass in an array you will get an array back.



Putting it All Together

To split an event over allocations, you can do something like this:

Col 1: Employee Name
Col 2 Expression: =duplicate(jobAllocationList('code'))
Col 3 Expression: =duplicate(listMap(jobAllocationList('amount'),{{ [duration]*[listMapValue]/100/3600 }} ))


©2004-2023 TimeIPS, Inc. All Rights Reserved - TimeIPS and the TimeIPS logo are registered trademarks of TimeIPS, Inc.
"Intelligent Personnel System" "Run your Business. We'll watch the clock." are trademarks of TimeIPS, Inc.
TimeIPS is protected by one or more patents. Patent No. US 7,114.684 B2.