Annotation
Annotation(comment_value, object_name, dimensional_context, comment_type='ANNOTATION', annotation_id=None, text='', creator=None, created=None, last_updated_by=None, last_updated=None)
Bases: TM1Object
Abtraction of TM1 Annotation
:Notes: - Class complete, functional and tested. - doesn't cover Attachments though
Initialize an Annotation object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
comment_value
|
str
|
The value of the annotation comment. |
required |
object_name
|
str
|
Name of the TM1 object the annotation is attached to. |
required |
dimensional_context
|
Iterable[str]
|
Iterable of dimension elements providing context. |
required |
comment_type
|
str
|
Type of the comment (default "ANNOTATION"). |
'ANNOTATION'
|
annotation_id
|
str
|
Unique ID of the annotation. |
None
|
text
|
str
|
Text of the annotation. |
''
|
creator
|
str
|
Creator of the annotation. |
None
|
created
|
str
|
Creation timestamp. |
None
|
last_updated_by
|
str
|
Last user who updated the annotation. |
None
|
last_updated
|
str
|
Last update timestamp. |
None
|
Source code in TM1py/Objects/Annotation.py
body
property
Get the annotation body as a JSON string.
Returns:
| Type | Description |
|---|---|
str
|
JSON string representation of the annotation. |
body_as_dict
property
Get the annotation body as a dictionary.
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary representation of the annotation. |
comment_value
property
writable
Get the comment value.
Returns:
| Type | Description |
|---|---|
str
|
The comment value string. |
created
property
Get the creation timestamp.
Returns:
| Type | Description |
|---|---|
str
|
Creation timestamp as string. |
dimensional_context
property
Get the dimensional context.
Returns:
| Type | Description |
|---|---|
List[str]
|
List of dimension elements providing context. |
id
property
Get the annotation ID.
Returns:
| Type | Description |
|---|---|
str
|
Annotation ID string. |
last_updated
property
Get the last updated timestamp.
Returns:
| Type | Description |
|---|---|
str
|
Last update timestamp as string. |
last_updated_by
property
Get the last user who updated the annotation.
Returns:
| Type | Description |
|---|---|
str
|
Username of last updater. |
object_name
property
Get the object name.
Returns:
| Type | Description |
|---|---|
str
|
Name of the TM1 object. |
text
property
Get the annotation text.
Returns:
| Type | Description |
|---|---|
str
|
The annotation text. |
construct_body_for_post(cube_dimensions)
Construct the body for POST requests to create an annotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cube_dimensions
|
List of cube dimension names. |
required |
Returns:
| Type | Description |
|---|---|
Dict
|
Dictionary for POST request body. |
Source code in TM1py/Objects/Annotation.py
from_json(annotation_as_json)
classmethod
Alternative constructor
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
annotation_as_json
|
str
|
String, JSON |
required |
Returns:
| Type | Description |
|---|---|
Annotation
|
instance of Annotation |
Source code in TM1py/Objects/Annotation.py
move(dimension_order, dimension, target_element, source_element=None)
Move annotation on given dimension from source_element to target_element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dimension_order
|
Iterable[str]
|
List, order of the dimensions in the cube. |
required |
dimension
|
str
|
Dimension name. |
required |
target_element
|
str
|
Target element name. |
required |
source_element
|
str
|
Source element name (optional). |
None
|
Returns:
| Type | Description |
|---|---|
|
None |