The package contains objects representing syntactical blocks of a TM1 rule. All contained classes are derived from a common ancestor TM1RuleToken
. The root class contains essential method convert
providing the splicing conversion. Derived classes redefine this method to achieve desired splicing conversion. Contained objects are described in following paragraphs.
TM1RuleToken
(class in TM1RuleToken.py
)
The class represents any string (token) contained within the associated rule with starting and ending position enumerated as number of characters from the rule beginning. This reflects notation in which parser enumerates parsed tokens when calling custom actions in Parser/TM1RuleParser
.
...
Method | Usage |
---|---|
| Method updates intrinsic attributes of the object by |
| Method returns length of |
| Method returns original value of |
| Method returns original value of |
TM1CalcRule
(class in TM1CalcRule.py
, derived from TM1RuleToken
)
This class represents entire TM1 calculation rule or a feeder command. It breaks down the calculation rule or a feeder into two essential parts - area statement (part before equal sign) and statement (part following equal sign, sign inclusive).
...
Method | Usage |
---|---|
| Method returns concatenated string composed from result of |
TM1RuleAreaStatement
(class in TM1RuleAreaStatement.py
, derived from TM1RuleToken
)
The class represents area statement of TM1 calculation rule or a feeder command. The area statement is decomposed to dimensions and hierarchy:element pairs belonging to each of the dimensions. This implies that the rule has to contain full specification of each element in the area statement. Not following this pattern in TM1 development will result in an error during splicing of the rule.
The convert
method implements splicing of dimensional elements based on directives that apply to the associated TM1CalcRule
. Once the directives are applied, the convert method will return modified area statement based on apply
method output.
The class defines following attributes:
Attribute | Type | Usage |
---|---|---|
|
| Whitespaces between |
|
| Whitespaces between dimension/hierarchy/element indices and |
|
| Link to directive resolver to identify all splicing directives that apply to the area statement of the TM1 rule. |
|
| Dictionary containing list of hierarchy/element pairs indexed by dimension, relating to dimension/hierarchy/elements as defined in the rule statement. |
|
| Dictionary containing list of hierarchy/element pairs indexed by dimension, relating to dimension/hierarchy/elements after splicing. |
|
| Flag indicating whether the splicing directives have been applied. |
|
| Link to |
The class exposes following methods:
Method | Usage |
---|---|
| Setter for |
| Returns list of keys from |
| Returns list of hierarchy/elements pairs from |
| Constructs converted_dim_elem_dict by either adding or merging new elements into the dictionary. The method is called from |
| The method will call |
| This method constructs and returns entire area statement after the directives have been applied by using |