Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter ElevenSGML Functions (continued)

XBRLGetContexts Function

Overview

The XBRLGetContexts function returns all contexts or contexts as filtered by various context properties.

Syntax/Parameters

Syntax

string[][] = XBRLGetContexts ( handle hXM );

string[][] = XBRLGetContexts ( handle hXM, string date_a, [string date_b] );

string[][] = XBRLGetContexts ( handle hXM, string date_a, string date_b,
                           string dimension, string value );

string[][] = XBRLGetContexts ( handle hXM, string date_a, string date_b,
                           string dimension[], string value[] );

Parameters

hXM

A handle to an XBRL Object containing instance data.

date_a

An optional string specifying the first date. This is the instant date or the starting date for a duration. If omitted, all dates, dimensions and members are allowed. Wild card characters are allowed. Add additional parameters with all starting/instant dates. use "*" as the value.

date_b

An optional string specifying the second date. This is the ending date for a duration. If omitted, all ending dates, dimensions and members are allowed. Wild card characters are allowed. Add additional parameters with all ending dates. use "*" as the value.

dimension

An optional string specifying a filter for the first dimension or any array to match all members. If omitted, all dimensions and members are allowed. Wild card characters are allowed.

value

An optional string specifying a filter for the first member or an array to match all members. If omitted, all members are allowed. Wild card characters are allowed.

Return Value

Returns a string table of context properties or an empty array on failure. Use the GetLastError function to retrieve a formatted error code.

Remarks

Each matching item is placed in the resulting table as a row with named columns for each context. The column employs the key names specified at Section 11.20.10 Instance — Contexts.

XBRLGetConcepts searches the entire context list for matches to return a set of filtered (or unfiltered) items. The domain is not specified since in a properly design taxonomy, each axis should be unique and related to a specific domain.

If there are no matching items, an empty array is returned.

Since the content list is sorted by identifiers, the resulting list will not necessarily be in the order of any of the filter parameters.

Filtering members by using non-array items will pass back all the contexts that match the first item. Additional filtering can be applied to the returned table by the caller.

If the array type is use, all the array entries must match the members for the context. The order of the member is not important. Use caution with wild cards on the dimension field since the process marks members that match and does not compare that member to subsequence array entries. As such, making the first dimension ‘*’ and ‘*’ will match the first member in the modeled context. The next array entry compare may not match if the first member match from the wild card has been eliminated. In other words, any wild card items should appear at the end of the array. In addition, each array must be the same depth.

When using wildcards, it is possible match more items than expected. To force a wild card array to match only the specified number of elements, add an empty string as the last item in both arrays. See the last example below.

Examples

To retrieve all contexts: 

table = XBRLGetContexts(hObject);

To retrieve all instant contexts with and without dimensions:

table = XBRLGetContexts(hObject, "2021-03-31", "");

To retrieve all duration contexts with and without dimensions:

table = XBRLGetContexts(hObject, "2021-01-01", "2021-03-31");

To retrieve a specific instant (note the blank fields for all dimensional are blank):

table = XBRLGetContexts(hObject, "2021-03-31", "", "", "");

To retrieve a specific duration (note the blank fields for all dimensional are blank):

table = XBRLGetContexts(hObject, "2021-01-01", "2021-03-31", "", "");

To retrieve all contexts with a specified typed axis and domain. It has two dimension parameters and a wildcard to allow for all values matching the axis and domain:

table = XBRLGetContexts(hObject, "2021-01-01", "2021-03-31",
                        "ferc:OtherAdjustmentAxis", "*");

To retrieve all contexts with a specified explicit domain. It has one dimension parameter and a wildcard to allow for all values matching the axis without the leading typed axis:

table = XBRLGetContexts(hXBRL, "2021-01-01", "2021-03-31",
                        "ferc:ProductsAndServicesAxis", "*");

To retrieve match items to both an explicit and type dimension:

dim[0] = "ferc:TransmissionServiceAndGenerationInterconnectionStudyCostsAxis";
vom[0] = "*";
dim[1] = "ferc:StudyTypeAxis";
vom[1] = "ferc:GenerationStudiesMember";

table = XBRLGetContexts(hXBRL, "*", "*", dim, vom); 

In this case, the first item is a typed dimension while grouped with the explicit dimension. Reversing the array items will have to effect of the results since each item item is matched against each candidate context’s members.

To retrieve specific dimensional pair(s), append a empty array element:

dim[0] = "ferc:TransmissionServiceAndGenerationInterconnectionStudyCostsAxis";
vom[0] = "*";
dim[1] = "ferc:StudyTypeAxis";
vom[1] = "ferc:GenerationStudiesMember";
dim[2] = "";
vom[2] = "";

table = XBRLGetContexts(hXBRL, "*", "*", dim, vom); 

This will require a match on a specified number of axis/values and then require that the matching context have no others.

Related Functions

Platform Support

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

Legato IDE, Legato Basic