Skip to content

Rules

Rules(rules)

Bases: TM1Object

Abstraction of Rules on a cube.

rules_analytics A collection of rulestatements, where each statement is stored in uppercase without linebreaks. comments are not included.

Source code in TM1py/Objects/Rules.py
def __init__(self, rules: str):
    self._text = rules
    self._rules_analytics = []
    self.init_analytics()

KEYWORDS = ['SKIPCHECK', 'FEEDSTRINGS', 'UNDEFVALS', 'FEEDERS'] class-attribute instance-attribute

body property

body_as_dict property

feeder_statements property

feedstrings property

has_feeders property

rule_statements property

rules_analytics property

skipcheck property

text property

undefvals property

__iter__()

Source code in TM1py/Objects/Rules.py
def __iter__(self):
    return iter(self.rules_analytics)

__len__()

Source code in TM1py/Objects/Rules.py
def __len__(self):
    return len(self.rules_analytics)

__str__()

Source code in TM1py/Objects/Rules.py
def __str__(self):
    return self.text

init_analytics()

Source code in TM1py/Objects/Rules.py
def init_analytics(self):
    text_without_comments = "\n".join(
        [rule for rule in self._text.split("\n") if rule.strip() and rule.strip()[0] != "#"]
    )
    for statement in text_without_comments.split(";"):
        if len(statement.strip()) > 0:
            self._rules_analytics.append(statement.replace("\n", "").upper())