11.6 Duration Deciders |
Whenever the XML allows a duration decider (instead of a concrete duration), these are the valid options:
component
id
="nameOfDurationTextbox"
/>) inside the parent element.To specify a duration, these elements can be set in the XML:
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.
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.
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".
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>