Moab Viewpoint
Duration Deciders

Duration Deciders

Whenever the XML allows a duration decider (instead of a concrete duration), these are the valid options:

  • A concrete duration. This is specified using the same syntax as a date decider. It has the same child elements.
  • Using the same syntax as above, each child element could also be an integer decider.
  • A UI component that holds a duration (such as <component id="nameOfDurationTextbox" />) inside the parent element.
  • A binary calculation.

Child Elements

To specify a duration, these elements can be set in the XML:

  • years
  • months
  • days
  • hours
  • minutes
  • seconds

The children in each of these elements must be an integer decider. Any value not set is assumed to be 0. Values specified above the theoretical maximum are converted (25 hours corresponds to +1 day and 1 hour).

Specifying a duration decider is very similar to specifying a relative date. However, a duration has no meaning until it is applied to a date. For example, a duration of one month differs depending on if it is currently February of March. A relative date is always applied to the current time at runtime.

Binary Operations

All binary operations require <first> and <second> elements (which themselves could be deciders). The type of decider is dependent on the binary-operation attribute value.

All binary operations require a <calculate> tag with an attribute binary-operation. The type of operation is dependent on the value of this attribute.

Duration Between Dates

The duration between dates binary operation string decider requires a two children date deciders. The result of the operation is the duration between these dates. Administrators specify the duration between date decider by setting the binary-operation attribute value to "between-dates".

Shortest Duration

The shortest duration binary operation string decider requires two children duration deciders. The result of the operation is the shortest of the two durations after evaluation. Administrators specify the shortest duration decider by setting the binary-operation attribute value to "shortest".

In this example, the user specified duration is compared to the duration from the "starttime" component to September 1st. The chosen duration is the one that is shortest. The user inputs an integer for "duration" and a date for "starttime".

<calculate binary-operation="shortest">
 <first>
  <months>
   <component id="duration" />
  </months>
 </first>
 <second>
  <calculate binary-operation="between-dates">
   <first>
    <component id="starttime" />
   </first>
   <second relative="false">
    <years>2010</years>
    <months>8</months>
   </second>
  </calculate>
 </second>
</calculate>