Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Appendix G — XDX Transaction Log Specification

1.0 Overview

1.1 General

1.1.1 Purpose

The XDX Transaction Log (XTL) is a structured representation of changes made to a document employing XDX technology. The transaction log contains only information that needs to be changed or is relevant to the process of changing the facts.

1.1.2 General Format

The log format will be plain text with commands on single lines. The commands will be written in a way to match natural languages whenever possible. Any amount of spaces or tabs will be treated as a single space unless inside a quoted value. Line returns are special characters so data that contains them will need to be encoded.

Data strings can be quoted. Inside the quotes actual quotes must be escaped by preceding them with a backward \ slash.

1.1.3 Command Groups

Commands are grouped into types that define what the affect in the XBRL. There are control commands, data commands and structural commands. The control commands do not apply any changes to the XBRL but rather set the state for any commands that follow. Data commands affect the XBRL data (facts, footnotes, precision, etc.). Structural commands edit the XBRL structure (presentation structure, calculations, context properties, etc.). Errors that occur while processing control commands may or may not prevent data and structural commands from being processed (depending on the error).

1.1.4 Versions

This document describes XTL version 1.2a (04/17/2023)..

2.0 XDX Transaction Log Structure

2.1 Structure

 2.1.1 Encodings

The transaction log format supports Base64 encoded data. The encoded data block will be preceded by a comment marking the start of encoded data. The encoded data is read until an end comment or blank line is read.

 2.1.2 Example Commands

Commands are in the form of “command: parameter” with the colon delininating the two parts. The command (record) continues until and EOL is reached (0x0D or various permutations). A ‘#’ character can be used to mark a comment.

SetPresentation: Statement - Balance Sheets

SetElement:      CashandCashEquivalentsAtCarryingValue

SetContext:      Asof2012-03-31

SetFact:         2000

SetContext:      Asof2011-12-31

SetEncoding:     base64

SetFact:

     # Start

     MjEwMA==

     # End

...

3.0 Header

The file may have a header section that defines various meta data to aid in later processing. The fields are as follows:

# Notice:

# Version: †

# Source:

# Taxonomy:

# Namespace:

# Period:

# Entity ID: †

# Entity Scheme: †

# Embedded extensions:

# Link XDX:

† Only supported by the XBRL Model Class.

 

Where: 

Notice — General copyright and patent notice.

Version — The version can be used as a file signature. It will always lead with “XDX/XTL”

Source — The fully qualified filename and path of the source file.

Taxonomy — A taxonomy nickname. This must be predefined taxonomy name.

Namespace — A coded string containing the following form:

prefix_domain_yyyymmdd

The prefix is used on all extension elements, namespace domain and the date of the namespace.

Period — The duration for the report, begin and end, in the form of:

yyyymmdd_yyyymmdd

Entity ID — An optional string specifying the primary entity ID for contexts. If omitted, the ID will be determined by the first fact and the corresponding element. If it is a well known element, it will automatically set the entity ID. For example, if the first fact/element is “EntityCentralIndexKey”, the fact data will be used by default.

Entity Scheme — An optional string specifying the primary entity scheme for contexts. If omitted, the scheme will be determined by the first fact and the corresponding element. If it is a well known element, it will automatically set the scheme. For example, if the first fact/element is “EntityCentralIndexKey”, the scheme will default to “http://www.sec.gov/CIK”.

Embedded Extensions — An optional starting position for embedded extensions. The extension data is in the same format as the XDX file except it is compressed and the Base64 encoded. This sequence will be ended with the “# End Embedded” header line.

Link XDX — An optional name of an extension XDX file.

4.0 Commands

The format of the function definitions are as follows. The function name is first followed by any parameters to the function. Parameters are separated by whitespace. Parameters that are optional are indicated by square brackets []. When more than one parameter is enclosed in square brackets the group of parameters are optional but must all be specified or not specified. Parameters that can be repeated are indicated by curly braces {}.

4.1 Control Commands

4.1.1 Set Presentation

Format:

SetPresentation: value

The value parameter is the full name of a presentation in the report or a pseudonym. While the presentation is not needed to create or update facts it will be used to determine the default properties of the fact including the precision and multiplication factors (if any).

Allowed pseudonyms are:

[cover]
[RR Summary]
[Level 1]
[Level 2]
[Level 3]
[narrative] 

If the presentation name is invalid processing of data commands will continue with the previous presentation selected. Any structural commands involving presentation changes (including calculations will fail).

Presentation names should match the naming convention employed for the specific taxonomy.

 4.1.2 Set Element

Format:

SetElement: element [attributes]

The element parameter is the full name of an element in the report. This sets the element that will be used when adding or updating facts or calculations.

The optional attributes parameter can contain presentation information for line item data to be deined within the current presentation. Data is comprised on a series of codes and an optional number. For example:

02I

Means indent level 2 and presentation row in ‘instant’.

nn  — Indent levelused to set the level or hierarchy for elements with in the current presentation.

B   — Block/Heading (abstract).

C   — Calculation

E   — Match period ending

H   — Date Heading

I   — Period Instant

M   — Use main presentation (not parent)

N   — Negated line item

P   — Parent Element

S   — Match period ending

T   — Total Line

If the element cannot be found all data manipulation commands will fail as well as any structural commands involving the element.

4.1.3 Set Context

Format:

SetContext: value

This sets the context that will be used when adding or updating facts. The value is a series of sub parameters deliniated by ‘_’ characters. The date and dimension parameters the XDX value for the context.

Both the date and dimension portions are optional.

Dates are in the format YYYYMMDD separated by an underbar (_). Examples:

yyyymmdd

yyyymmdd_yyyymmdd

yyyymmdd_axis_member

yyyymmdd_yyyymmdd_axis_member_axis_member

A single date represents an instant period where two dates represent a duration as start and end, respectively.

If the date is omitted, the report date applies.

An optional dimension parameter can follow in the form of

_axis_value ...

specifying any dimension and member combinations that apply to the context. The value may also be set to a special case of “-report-”. This case indicates the context should be set to the primary context of the XBRL file.

It is possible for context with multiple dimensions are equal with the pairs in dissimilar order. Writer can be lazy when setting the context dimension values. Readers must sort the pairs for comparison to avoid duplicate contexts.

If the context cannot be found all data manipulation commands will fail as well as any structural commands involving the context.

4.1.4 Set Encoding

Format:

SetEncoding: value

The value is an encoding type. Currently only two types are supported:

none – data will not be encoded

base64 – data will be encoded using Base64

An invalid value will result in the encoding being set to none.

4.1.5 Override Precision

Format:

OverridePrecision: value

The value is the new precision to use (don’t use presentation defaults). It must be a value between -15 and 15 inclusive or ‘i’ for infinite. Negative values indicate rounded precision (ie thousands is -3). An empty value will remove the override.

4.1.6 Override Counted

Format:

OverrideCounted: value

The value is the new counted as amount to use (don’t use presentation defaults). It must be a value between -15 and 15 inclusive. Negative values indicate rounded precision (ie thousands is -3). An empty value will remove the override.

4.1.7 Override Unit

Format:

OverrideUnit: value

The value parameter is the name of the unit to use for upcoming SetFact calls. An empty value will remove the override. 

4.1.8 Set Taxonomy

Format:

SetTaxonomy: value

The value is the name of the taxonomy to be used for the report. This action should only appear once in a transaction log.

4.2 Data Commands

4.2.1 Set Fact

Format:

SetFact: value

The current element and context will be used to create a fact with this value. The current value, if any, will be overwritten. To set a nil fact the value field must be blank. If an encoding is turned on a blank value indicates the value has been encoded and will follow this command.

If any of the required state commands have not been set up or failed this command will fail.

4.2.2 Remove Fact

Format:

RemoveFact:

The current element and context will be used to find a fact. If a fact exists using the element and context it will be removed from the report.

If any of the required state commands have not been set up or failed this command will fail.

4.2.3 Add Reference

Format:

AddReference: value

The current element and context will be used to add a footnote reference to an existing fact. If such a fact does not exist it will be created with a nil value. The current references, if any, will still remain. To set multiple references use the command multiple times. The value is the text of the footnote. If the footnote text is not in the report it will be added.

4.2.4 Remove Reference

Format:

RemoveReference

The current element and context will be used to remove all footnote references from an existing fact. If such a fact does not exist this command will be ignored. If all references to a footnote are deleted the footnote will be deleted.

4.2.5 Set Label

Format:

SetLabel value [role]

The current element and presentation will be used to set the label for the element on this presentation. If more than one label for this element exists on the presentation the role parameter will be used to determine which label is changed. The role field is the short name for the corresponding XBRL label role including standard, terse, verbose, total, beginning, ending, negated, negatedterse, negatedtotal, negatedbeginning, and negatedending. If the role value is not set or unrecognized it will be set to the default value of standard.

If any of the required state commands have not been set up or failed this command will fail. 

4.2.6 Set Cell by Reference

Format:

SetCellByReference: id value

The id will be used find a unique cell within an XBRL spreadsheet. The ID consists of a three groups of eight hexadecimal characters. The first eight characters are a unique identifier for a presentation. The next two are the X and Y positions respectively. The value is the value to place in the cell. If an encoding is turned on a blank value indicates the value has been encoded and will follow this command.

4.2.7 Add Calculation

Format:

AddCalculation: calculation

Adds a calculation to the current presentation and element. The calculation must be in a specific format which is in the form of =(weight*element)+(weight*element2)[...] and so on. Weight should be either 1 or -1 indicating addition or subtraction.

4.2.8 Add Unit

Format:

AddUnit: name defaultfor numerator [denominator]

Adds a unit with the given name to the report. If a unit with that name already exists it’s properties will be updated instead. The default for parameter specifies if the unit is a default unit for a specific data type. The numerator is the numerator for the unit and the denominator is the denominator for the unit.

4.2.9 Remove Units

Format:

RemoveUnits:

Removes all the units in the report. This command should not be used on existing reports but only when creating a new report as it does not remove the units from existing facts.

4.2.10 Set Position

Format:

SetPosition: element type

Sets the position of the next element added to a presentation using the referenced element. The type indicates the type of the relationship to the referenced element. If the referenced element is not on the presentation it will be added. A type of 1 indicates the next element should be added as a child of the specified element. A type of 2 indicates the next element should be added before the specified element at the same level. A type of 3 indicates the next element should be added after the specified element at the same level.

4.2.11 Add Label Override

Format:

AddLabelOverride: element role label

Adds a label to be used when creating the label linkbase. This label will be used in place of any other label in the report when linkbases are created. This will add entries to the Additional Labels presentation on the XBRL spreadsheet. The element parameter is a qualified element name. The role parameter is the URI of the label role. The label parameter is the base64 encoded label. Base64 encoding is used to prevent issues with quotes and line endings.

4.3 Structural Commands

4.3.1 Add Presentation

Format:

AddPresentation: name [precision power] [root]
                 [definition {dimension domain} [table] [line]]

A presentation will be created with the specified name. Other options are default precision for monetary facts. Power to multiple monetary facts by when entering data. The root element for the presentation. The presentation dimensional information which includes the definition for the axis matching, dimension and domain elements, as well as the table and line items elements. Up to 10 dimensions and domain elements may be added to a single presentation.

If a presentation already exists with the same name it will be unchanged and a new presentation with the same name will be added with the above options.

4.3.2 Add Context

Format:

AddContext: type start [end] [{dimension member}]

The context described by the properties above will be created. Valid types are Duration and Instant. The end date parameter must not be specified when the type is instant. The start and end parameters describe the period of the context and must be valid dates in YYYY-MM-DD format. The dimension and members are optional and describe any dimensional information for this context. Up to 10 dimensions and member elements may be added to a single context.

If a context with the same properties already exists no context will be created. The context identifier will automatically be created based on the properties. If a context with the same identifier exists (and the properties are different) the context will still be created with a different identifier.

4.3.3 Remove Presentation

Format:

RemovePresentation: name [deletefacts]

The presentation with the specified name will be removed from the report. The optional parameter deletefacts will cause all facts on the presentation to be deleted. 

4.3.4 Remove Context

Format:

RemoveContext: identifier

The context with the specified identifier will be removed from the report. All facts using this context must be removed prior to this call. Contexts that still contain data cannot be deleted from a report.

4.3.5 Create Element

Format:

CreateElement: name properties

Create an element with the given name and properties. The name must follow the XBRL naming conventions and the properties are a 32-bit value that describes the element. [describe format of value]