TreeGrid v6.4
Gantt resources
The resource list is defined globally for whole chart in <Resources> root tag.
The individual resources can be assigned to tasks to compute their price.
The tasks can filtered according to the assigned resources.
TreeGrid provides various calculations for resources and prices.
Resources are defined globally for the whole project in root tag <Resources>, individual resources are defined in nested <R> tags.
For example simple definition can be:
<Grid>
...
<Resources>
<R Name=’Resource1’ Price=’100’/>
<R Name=’Resource2’ Price=’200’/>
</Resources>
</Grid>
<Resources> <R> new 6.4 .
One resource definition. It can be placed only in root <Resources> tag.
<R> string Name new 6.4 .
Unique name of the resource.
<R> string Text new 6.4 .
Text displayed for the resource in the popup menu for assigning resources to the task.
If not set, the Name is used.
<R> int Type [1] new 7.0 .
Type of the resource.
1 – Work, not consumed resource. The Availability is the maximal count per time unit.
2 – Material, consumed resource. The Availability is calculated from start and consumed per every used time unit.
<R> float Price new 6.4 .
Price per one resource unit.
The resource units are set by GanttDataUnits.
<R> string Availability new 7.0.
Resource availability. Maximal summary count of resource units assigned to all tasks at one time unit (Type=1) or for whole project (Type=2).
Since 7.0 it can contain more values for given date ranges, in format: repeater1#date1a~date1b#count1;repeater2#date2a~date2b#count2;....
The possible values of repeater are the same as GanttUnits, e.g. “w”, “d”, “h” or “1”, “0.5”, “2”, ... If the repeater is not present, the date range is not repeated
The date range is range where the count of resources is available. The date range can be periodically repeated by the repeater.
For Material Type resources is used only the first date from date range as date when the count of resources arrives.
If some date ranges are overlapped, the count values are summed. The count can be also negative to reduce the count for some range.
For example “3;w#1/3/2011~1/4/2011#-1” – The resource count is 3 except Mondays when is 2.
It is possible to limit the repeating - when the date range is wider than the repeater, the range is rounded to the repeater range and repeated only between the dates.
For example ‘w#1/5/2008~12/29/2008#1’ marks all weekends, but only in year 2008.
The availability can be easily edited by users in dialog for Dates type Button.
<R> float MaxCount new 6.4; deleted 7.0.
Renamed to Availability
API variable object[] Resources new 6.4 .
The array of all resources in grid, accessible by its name.
The resource objects contain all the XML attributes like Price or Availability.
Example: Grid.Resources.Worker.Price = 150;
Every task can have assigned one or more resources from global <Resources> list. It can have also specified how many resource units it uses.
<C><cell> string GanttResources Gantt source – column name or exact value chg 7.0 .
The resources assigned to the task. It can be column name or string
It is in format: name1*amount1+extra1;name2*amount2+extra2;...
Resources are separated by semicolon (defined by <Format ValueSeparator/>), the name and amount are separated by asterisk (defined by <Format CountSeparator/>),
the extra is separated by plus (defined by <Format AddSeparator/>).
The name is resource Name.
The amount is amount of resource units per task data unit. The amount can be omitted if it is 1 and extra is not defined.
The extra is extra amount of resource units independent on the task duration. The extra can be omitted if it is 0. This item changed its meaning in 7.0!
If the name and amount are both omitted, the extra is extra price for the task independent on resources and task duration. There should be only one such extra price per task.
The GanttResources can be also just plain text to display it next to task, without filtering and pricing functionality.
<C> int GanttResourcesAssign [4] new 6.4 .
How the resources can be assigned to the task, affects the menu for assigning resources.
The behavior can be more modified also by GanttResourcesMenu.
0 – Only one resource can be assigned to the task, the menu is clickable. The Extra prices are not shown.
1 – The resources can be assigned only as 0/1, the checkboxes are shown - set Default: { Bool:1 }
2 – The resources can be assigned as 0 – 10, the enums are shown – set Default: { Enum:1, Width:22, Items:["","1","2","3","4","5","6","7","8","9","10"] }
3 – The resources can be assigned as integers, the edits are shown – set Default: { Edit:1, Width:40, Type:”Int”, Size:5 }
4 – The resources can be assigned as floats, the edits are shown –
set Default: { Edit:1, Width:60, Type:”Float”, Format:"0.##;;", DisplayFormat:"0.00;;", EditMask:"^\\d{0,5}(\\.\\d{0,2})?$"}
5 – Only extra price and resource units permitted by GanttResourcesExtra are shown.
<C> int GanttResourcesExtra [0] new 6.4; chg 7.0.
If and how will be possible to add extra prices and resource units to tasks when editing resources from menu.
0 – no extra price possible.
1 – one extra price per whole task
2 – extra resource units per task
3 – both extra price and extra units
If set to 1 or 3, the resource names should not be numbers.
<C><cell> string GanttResourcesMenu new 6.4 .
Optional menu to assign the resources to the task. Here is possible to specify which resources and how can be assigned to the individual task.
It is standard TreeGrid menu.
The items must be named (Name attribute) as resource names to be correctly assigned.
The Name of the extra task price item must be “Extra”, the names of extra resource units must be name+”Extra”
<Actions> EditGanttResource Attached to OnDblClickGantt event .
Lets a user to assign resources for the task in popup menu
The tasks can be easily filtered according to assigned resources.
User interface for filtering by resources can be added to grid by cell Type=’SelectGanttResources’
<Space cell> string Type Type=”SelectGanttResources” new 6.3 .
Special combo box to choose resources to display in grid. It hides all rows that do not contain any selected resources
It presets these cell attribute: Type=”Html” Button=”Defaults” Defaults= "|*None|-|*RowsVariableCol"+resource col+"*"
OnChange= "Grid.FilterTextRange('"+ resource col +"',Value);" Range=”1”
Requires GanttResources to be defined in <C> tag.
<C> int GanttResourcesFilter Saved to cookies, to avoid it set <Cfg GanttLap=’1’/> new 6.4 .
Predefined filter for the resources, contains the resource names separated by semicolon.
The grid will show only tasks containing these resources.
API method float GetGanttPrice (TRow row, string col, int bar = null) new 6.4 .
Returns price of the bar according to its duration and assigned resources
If bar is null uses bar according to the GanttObject. Otherwise bar is 1 for main bar, 2 for flow and 3 for run.
In Formula it can be called as Grid.GetGanttPrice(Row,”XXX”) where XXX is Gantt column name.
API method float[][] GetGanttResourcesUsage (string def, TRow row, string col, string units, int bar, bool notmp) new 6.4 .
Returns all resource usage per unit in two dimensional array.
The array contain resource usage object by resource name.
The resource usage array contains count of resource per one unit, starting from 0 as the first unit displayed in the chart.
The array contains only work time, all holidays are excluded.
All parameters can be null.
def – name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
row – if set, it iterates only children (and their children) of the row.
col – gantt column to use, if not set, the first gantt column in grid will be used
units – data units to create the list for, the same values as GanttDataUnits. If not set, the GanttDataUnits will be used.
bar - 1 for main bar, 2 for flow and 3 for run. If not set, uses bar according to the GanttDependencyObjects.
notmp – if not set, the functions iterates the grid only once per grid calculating (calling Calculate/Recalculate). It means that two calls in one calculating return the same object. If set notmp, the list is always created new.
API method float[] GetGanttResourceAvailability (string resource, string col) new 7.0 .
Returns availability of given resource.
If resource Availability is one number, it returns just this number.
Otherwise it returns array of counts of resource units per GanttDataUnits. The individual array items have the same positions as one array got by GetGanttResourcesUsage method.
For material resources (Type=2) returns all possible units, not consumed by their usage in tasks, to get consumed resources, subtract the results by got GetGanttResourcesUsage method.
API method float GetGanttResourceCount (string res, int start, int end, int type, string col, string def) new 6.4 .
Returns information about the resource res usage between dates start and end.
The start and end can be Date object, number of milliseconds or date string in English.
def – name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
col – gantt column to use, if not set, the first gantt column in grid will be used
type = 0 – returns Total – Sum of all resource units used in the range
type = 1 – returns Peak – Maximum count of the resource in the range at the same time.
type = 2 – returns Average – Average usage of the resource in the range
formula float ganttresourcepeak (string resource, string def) new 6.4 .
Returns maximal count of the resource used in grid at one time
resource is Name of the resource.
def is name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
formula float ganttresourceunits (string resource, string def) new 6.4 .
Returns count of all allocated units for given resource in the whole grid.
If the value is multiplied by resource price, you will get the summary cost of the resource in the project
def is name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
formula float ganttresourcesextra (string def) new 7.0 .
Returns summary of extra prices assigned to all tasks
def is name of default row (Def attribute). Only variable rows with this default will be iterated. If not set, all variable rows are iterated.
formula float ganttresourceextra (string resource, string def) deleted 7.0.
Since 7.0 version there are no extra prices per resource, only per task.
The usage of individual resource in grid can be shown in row in gantt Chart object of type “Resources”.
Set attribute GanttChart=”Resources”.
The resources usage chart can be combined also with other Gantt objects.
<C><cell> string GanttChart GanttChart = “Resources” new 6.4 .
Shows the resource usage chart in the Gantt cell
<C><cell> string GanttChartResource new 6.4 .
Name of the resource to show in the resource usage chart.
<C><cell> int GanttChartResourceType [3] new 7.0 .
What chart will be shown.
1 – resource usage, 2 – resource availability, 3 – both resource usage and availability
4 – resource errors, 6 – both resource errors and availability
The values 5 and 7 are also possible, but it has not sense to show both resource errors and usage charts.
<C><cell> string GanttChartResourceDef new 6.4 .
If set, only rows with the given default name (Def attribute) are iterated for the resource usage.
<C><cell> string GanttChartResourceFormat new 6.4 .
Format of the number shown in the resource chart.
The same as TreeGrid number format.
The resource usage chart can be automatically generated from another (even invisible) grid.
The resources list can be modified, the resources can be added, deleted, changed or renamed.
There are must be two grids on page, master and detail.
Detail grid is the grid displaying the resources usage chart.
It should have defined only layout XML source.
The body rows are automatically generated from master’s <Resources> list. This way is defined by detail’s attributes <Cfg GanttResources... /> attributes.
The detail grid can contain Gantt column to show the resources usage from the master grid. Use the attributes for Resources usage chart.
The detail’s Gantt column reads these attributes from master’s Gantt column:
DataUnits,EndLast,Exclude,Include,MaxExclude,HeaderTrim,Background,Zoom,SmoothZoom,ZoomList,Width,Units and the <Zoom> tag
Changes in the resources list should be uploaded from detail grid as normal changes in data rows.
Master grid is the source grid.
The master grid must contain standard Gantt chart with tasks with assigned resources and global resources list in <Resources>.
The master’s <Resources> list is automatically updated after any change (add, deleted, modify, rename) in the detail grid.
The master grid be displayed and recalculated according to the changes in resources.
The resources assigned to tasks are not automatically changed after resource is renamed or deleted and should be done manually in some API event.
Or the master grid can be hidden (<treegrid Hidden=’1’) and used only as resources list source
<Cfg> string GanttResourcesMaster new 6.4 .
Base attribute in automatically generated resource usage chart.
Specifies id of the master grid from where this detail grid’s resource chart will be calculated.
<Cfg> string GanttResourcesName [“Name”] new 6.4 .
Name of column in detail grid where the resource Name will be displayed and edited
<Cfg> string GanttResourcesType [“Type”] new 7.0 .
Name of column in detail grid where the resource Type will be displayed and edited
<Cfg> string GanttResourcesPrice [“Price”] new 6.4 .
Name of column in detail grid where the resource Price will be displayed and edited
<Cfg> string GanttResourcesAvailability [“Availability”] new 7.0 .
Name of column in detail grid where the resource Availability will be displayed and edited
<Cfg> string GanttResourcesMaxCount [“MaxCount”] new 6.4; deleted 7.0 .
Renamed to GanttResourcesAvailability
<Cfg> string GanttResourcesGantt [first Gantt column in master grid] new 6.4 .
The Gantt column in master grid where to read the resources usage (this attribute is still set in detail grid).
<Cfg> string GanttResourcesChart [first Gantt column in detail grid] new 6.4 .
The Gantt column in detail grid where to display the resources chart
<treegrid,bdo> bool Hidden [0] new 6.4 .
If set to 1 the grid is never rendered and can be used as invisible data source for other grids or other page components.
The hidden grid has not set MainTag and cannot be shown at all.
It can be set in master grid to use it just as data source.