Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FiveGeneral Functions (continued)

DurationToComponents Function

Overview

The DurationToComponents function parses a formatted duration string and returns a list of components. For example, “P1M” returns 100 or one month.

Syntax/Parameters

Syntax

PVALUE [] = DurationToComponents ( string duration );

Parameters

duration

A string containing an XML/ISO-8601 formatted duration string.

Return Value

Returns a PVALUE (dword) array containing the duration components or an empty array on failure. Use the GetLastError function to retrieve error information.

Remarks

The values are returned in 100ths using as PVALUE (or dword). The SGMLValueToString function can be used to convert the value to a string or used as fixed decimal point integers (two decimal places). Related math functions can also be used.

The returned array elements are named as follows:

  Key Name   Description  
  Negative   Present and set to non-zero if the string was preceded by a dash (‘-’) symbol.  
  Years   Years, if specified.  
  Months   Months, if specified.  
  Weeks   Weeks, if specified  
  Days   Days, if specified.  
  Hours   Hours, if specified..  
  Minutes   Minutes, if specified.  
  Seconds   Seconds, if specified.  

 

If a value is not specified, the key name will not be present in the list.

This function differs from DurationToTimeComponents in that it does not perform any analysis of the data. For example, if the “P28M” months is processed, the result is 2800 or 28.00 months. If processed by DurationToTimeComponents, the result would be 2 years and 4 months.

Related Functions 

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic