Duration

In terms of OmniPlan projects, a duration is a specified amount of time. The time represented by an instance of the Duration class is organized as either “project time” or “elapsed (contiguous) time.”

The length of time required to complete OmniPlan projects is expressed in standard time increments, such as days, weeks, months, and years. And it is common for the time it takes to complete a task, to span multiple “work-days” which are comprised of a specified number of “work-hours” per overall day.

However, some tasks, such as pouring and setting concrete, by nature require that their process be done in one pass, no matter how many contiguous hours that may require. This measure of time is called “elapsed-time” which is a single contiguous amount of time.

To visualize the relationship between the two duration formats (work-time & elapsed-time), imagine you’ve mixed up a pint of Jello®! You can pour the mixture into either three small cups, or into one larger cup. The smaller cups may take up more space on the counter but they contain the same amount of Jello as the larger cup — it’s the packaging that is different.

jello-combo

This same relationship applies to how time is displayed in OmniPlan. A duration is a value that can be measured via the project schedule components or via elapsed time. The default is via project schedule, but scripts can create durations of either type when necessary.

Instance Properties

The properties of a duration instance. These can be used to retrieve the time values of duration objects in the desired format.

Class Functions

Functions for creating instances of the Duration class. Use these functions to create instances of the Duration class in the desired format.

duration = Duration.workHours(15) duration.workSeconds
duration = Duration.elapsedDays(5) duration.elapsedDays

Work-Time Example

Assigning a duration of 12 work-hours to a new task:

task = actual.rootTask.addSubtask() task.title = "Task taking 12 work-hours" task.duration = Duration.workHours(12)
omniplan://localhost/omnijs-run?script=try%7Btask%20%3D%20actual%2ErootTask%2EaddSubtask%28%29%0Atask%2Etitle%20%3D%20%22Task%20taking%2012%20work%2Dhours%22%0Atask%2Eduration%20%3D%20Duration%2EworkHours%2812%29%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D
new-task-with-duration

Note the task occurs over a two-day period, with the first section of time being the 8-hours of the first day, and the second section of time consisting of the remaining four hours.

Elapsed-Time (Contiguous-Time) Example

Creating a project task with a contiguous-time duration of 26½ hours:

task = actual.rootTask.addSubtask() task.title = "Paint Room including Drying Time" task.duration = Duration.elapsedHourMinSec(26,30,0)
omniplan://localhost/omnijs-run?script=try%7Bduration%20%3D%20Duration%2EelapsedHourMinSec%2826%2C30%2C0%29%0Atask%20%3D%20actual%2ErootTask%2EaddSubtask%28%29%0Atask%2Etitle%20%3D%20%22Paint%20Room%20including%20Drying%20Time%22%20%0Atask%2Eduration%20%3D%20duration%7Dcatch%28err%29%7Bconsole%2Elog%28err%29%7D
contiguous-time-task

As with the previous example, this task occurs over a two-day period, but consists of a single contiguous block of time, which is not segmented to fit into the default “work-day” format of 8-hours per day.

UNDER CONSTRUCTION

This webpage is in the process of being developed. Any content may change and may not be accurate or complete at this time.

DISCLAIMER