# Language Reference

## Comments

There are three ways to annotate a project file with comments. All text in a line after a hash mark '#' or a pair of slashes '//' will be ignored. Comments that span multiple rows must be started with '/*' and ended with '*/'.

## Attribute Classes

### DATE

A DATE is an ISO-compliant date in the format `YYYY-MM-DD[-hh:mm[:ss]][-TIMEZONE]`. Hour, minutes, seconds, and the `TIMEZONE` are optional. If not specified, the values are set to 0. The local timezone or the default timezone is used if no other is specified. If the timezone is not known, TaskJuggler will fall back to UTC (GMT). The value of TIMEZONE can either be a timezone name or – since this can be ambiguous – the offset to GMT as `+HHMM` or `-HHMM`. See the source code (`taskjuggler/Utility.cpp`) for details.

### DATEINTERVAL

There are three ways to specify a date interval. The first is the most obvious. A date interval consists of a start and end DATE. The start and end dates may be separated by a hyphen character. In the second form, the end date is omitted. A 24 hour interval is assumed. The third form specifies the interval duration. In this form the start date is followed by a plus character. The plus character must be separated from the start date by a space or newline character. The plus must be followed by a number and a UNIT:

    2006-02-18 - 2006-02-19
    2006-02-18
    2006-02-18 +1d

### GLOBAL_ID

A GLOBAL_ID may have the same characters as ID, but additionally may contain dots '.' and exclamation marks'!'. An exclamation mark '!' may only be used at the beginning and is used in relative IDs; each '!' means one level up.

### ID

A string that may consist of the characters A–Z, a–z, 0–9, and _. It may not start with a number.

### INTEGER

A number that is an integer.

### LOGICALEXPRESSION

A logical expression consists of logical operations, such as '&' for and, '|' for or, '˜' for not, '>' for greater than, '<' for less than, '=' for equal, '>=' for greater than or equal and '<=' for less than or equal to operate on INTEGER values or symbols. Flag names and certain functions are supported as symbols as well. The expression is evaluated from left to right. '˜' has a higher precedence than other operators. Use parentheses to avoid ambiguous operations. If flagFoo, flagFooBar, and flagBar are declared flags, the following example is a correct expression:

    (flagFoo | flagFooBar) & ˜flagBar

The following functions can be used in logical expressions:

hasAssignment(ID, DATE, DATE)

  true if the task or resource currently has allocations in the specified time interval in the scenario with the specified ID.

isChildOf(ID)

  true if the property has ID as sub.

isParentOf(ID)

  true if the property has ID as enclosing property.

isLeaf(ID)

  true if the property has no sub properties.

endsAfter(ID, DATE)

  true if the task ends in scenario ID after the specified date

endsBefore(ID, DATE)

  true if the task ends in scenario ID before the specified date

isAnAccount()

  true if the property is an account

isAccount(ID)

  true if the account has the listed ID

isAllocated(ID, DATE, DATE)

  true if the resource has been allocated in the specified time interval in the scenario with the specified ID.

isAllocatedToProject(PRJID SCENARIOID, DATE, DATE)

  true if the resource has been allocated to the specified project in the specified time interval in the scenario with the specified ID.

isDependencyOf(TASK, HOPS)

  true if a task is a dependency of the specified task and no more than the specified number of hops away.

isMilestone()

  true if the task is a milestone.

isAResource()

  true if the property is a resource ID.

isResource(ID)

  true if the resource has the listed ID.

isATask()

  true if the property is a task.

isTask(ID)

  true if the task has the listed ID.

isOnCriticalPath(ID)

  true if the task is on a critical path in scenario ID.

isTaskStatus(ID, STATUS)

  true if the task has in scenario ID the specified status. STATUS can be any of `notstarted`, `inprogresslate`, `inprogress`, `ontime`, `inprogressearly`, `late`, `finished`.

startsAfter(ID, DATE)

  true if the task starts in scenario ID after the specified date

startsBefore(ID, DATE)

  true if the task starts in scenario ID before the specified date

isTaskOfProject(ID)

  true if the task is part of the project with the specified ID.

isDutyOf(RESOURCE_ID, SCENARIO_ID)

  true if the resource with the specified ID is assigned to the task in the specified scenario.

treeLevel()

  Nesting level of the property.

### REAL

A real number (e.g., 3.14).

### SORTINGCRITERIA

See attribute description for allowed values.

### STRING

A string may contain any characters and is enclosed in single quotes or double quotes. A single quoted string may contain double quote characters and vice versa. A string may include line breaks. To include single quotes in a single quoted string the single quotes have to be preceded by a backslash character to escape them. This works for double quoted strings as well.

### TIME

A time in the format HH:MM.

### TIME

A time interval consists of a start and end TIME. The start and end times must be separated by a hyphen character.

### UNIT

May be `min` for minutes, `h` for hours, `d` for days, `w` for weeks, `m` for months, `y` for years. Week, month, and year specifications are only approximated values and are handled slightly differently for length, effort, and duration intervals. For length and effort only working days are counted. The number or working days per week, month or year is determined by the setting of yearlyworkingdays. The number of working hours or minutes per working day is determined by the setting of dailyworkinghours.

### WEEKDAY

May be one of

- `mon` for Monday
- `tue` for Tuesday
- `wed` for Wednesday
- `thu` for Thursday
- `fri` for Friday
- `sat` for Saturday
- `sun` for Sunday

Optional attributes of a property must be enclosed by curly braces {}.

## Macros

### Automatic macros

Automatic macros are implicitly defined and updated in conjuction with the setting of the corresponding project property. Automatic macros always have all-lowercase names.

TaskJuggler supports the following automatic macros, which all default to the moment when TaskJuggler was invoked:

- `now`
- The current date and time as defined in the project header.
- `projectend`
- The project end date and time as defined in the project header.
- `projectstart`
- The project start date and time as defined in the project header.

### User defined macros

User defined macros are defined in the project file by using the macro property. The name of a user defined macro must have at least one uppercase character in order not to conflict with automatic macros that might be added with later versions of TaskJuggler.