duration XML element
- Last UpdatedJul 18, 2024
- 2 minute read
The duration element represents a duration range. It contains the retrieval types that are used when the trend period is longer than the time period it specifies.
A retrieval style can contain any number of duration elements. However, you should arrange these elements in descending length. This is because the Trend application uses the first suitable duration range that it finds, that is, the first duration range with a time period shorter than the current trend period.
For example, assume you have three duration ranges defined in the following order:
-
1 day
-
4 hours
-
0 seconds
For a query with a duration of 2 days, the Trend application uses the retrieval types defined for the "1 day" duration range because it is the first range whose time period is shorter than 2 days. Now assume the same duration ranges are ordered like this:
-
4 hours
-
1 day
-
0 seconds
In this case, the Trend application uses the retrieval types defined for the "4 hours" duration range because again, it is the first range whose time period is shorter than 2 days. The more suitable "1 day" duration range is ignored.
Note: You should always define a duration range with a time period of 0 seconds. This serves as a "catch-all" for trend periods that aren’t covered by any other duration range.
The duration element has one required attribute:
-
minSpan: Specifies the time period as a standard XML duration value, for example, P0Y0M1DT0H0M0S. The number to the left of Y represents the number of years, the number to the left of M represents the number of months, and so on (D = days, H = hours, M = minutes, S = seconds). P and T are separator characters.
It is the container for one other element:
-
retrieval: Specifies a retrieval type. For more information, see retrieval XML Element.