AnnotationService
import { AnnotationService } from "@skipcheck/tm1-client";Annotations: comments on cube cells, as Planning Analytics Workspace makes them, and the application context facets that tie them to cubes.
What TM1 (11.8) does here that you might not expect:
GET Annotationslists none, even with annotations made. They're found by cube (cubeAnnotations), by cell (cellAnnotations), or by ID.- An annotation's
ApplicationContextreads back empty, though the facet value given when it was made exists (facetValues). - Besides
Text, an annotation carries properties$metadatadoesn't declare (Annotationis an open type):objectName(the cube),commentValue,commentTypeandcommentLocation(the cell's elements, comma-separated). They're indynamicProperties. - IDs look like
C}ClientGroups~B.B~7uA_4TxLwG.
Comment on a cell:
// A comment on one cell, as Planning Analytics Workspace makes it: the cell's elements by
// dimension, in the cube's dimension order
const cell = { Version: "Forecast", Region: "North", Measure: "Amount" };
return tm1.annotations.create("Sales", cell, "Includes the March promotion");
Read a cube's comments:
// GET Annotations lists none on TM1 11.8, so read them by cube
const comments: string[] = [];
for await (const annotation of tm1.annotations.cubeAnnotations("Sales")) {
comments.push(`${annotation.Creator}: ${annotation.Text}`);
}
return comments;
Change what a comment says:
// TM1 keeps Text and the commentValue PAW shows apart, so change both
const text = "Includes the March and April promotions";
return tm1.annotations.update(id, AnnotationPatch.builder().text(text).property("commentValue", text).build());
Members
list | GET Annotations, streamed. |
get | The annotation, or a Tm1NotFoundException if there's none. |
create | Annotates one cell, the way Planning Analytics Workspace does. |
create | POST Annotations, for an annotation built by hand; returns it as made, with its ID. |
create | |
update | PATCH Annotations('id'). |
delete | DELETE Annotations('id'). |
applicationContext | ApplicationContext, streamed. |
dimensionalContext | DimensionalContext, streamed. |
attachments | Attachments, streamed. |
cubeAnnotations | Cubes('c')/Annotations, streamed. |
cellAnnotations | Cellsets('id')/Cells(n)/Annotations, streamed. |
facets | GET ApplicationContextFacets, streamed, such as }Cubes (expand Values with the query). |
facetValues | A facet's Values, streamed. |
facet | A facet value's Facet. |
deleteAnnotationArtifacts | Removes every annotation in the model, with their facet values, attachments and control cubes. |
list
list(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Annotation>GET Annotations, streamed. TM1 (11.8) lists none here: use cubeAnnotations or cellAnnotations.
TM1 REST EntitySet Annotations
get
get(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<Annotation>GET Annotations('id'): the annotation, or a Tm1NotFoundException if there's none.
TM1 REST EntitySet Annotations
create
create(cube: string, elements: Tm1Map<string>, text: string, options?: Tm1CallOptions): Promise<Annotation>Annotates one cell, the way Planning Analytics Workspace does: Text and commentValue are the text, the }Cubes facet names the cube, and the dimensional context binds the cell's members. elements is the cell's element in each dimension's same-named hierarchy, by dimension, in the cube's dimension order (a Map keeps it whatever the names). Returns the annotation, with its ID.
TM1 REST EntitySet Annotations
create
create(annotation: AnnotationPatch, options?: Tm1CallOptions): Promise<Annotation>POST Annotations, for an annotation built by hand; returns it as made, with its ID.
TM1 REST EntitySet Annotations
create
create(first: string | AnnotationPatch, second?: Tm1Map<string> | Tm1CallOptions, text?: string, options?: Tm1CallOptions): Promise<Annotation>TM1 REST EntitySet Annotations
update
update(id: string, patch: AnnotationPatch, options?: Tm1CallOptions): Promise<void>PATCH Annotations('id'). To change what it says, set both Text and the commentValue property: TM1 keeps them apart. TM1 records LastUpdatedBy and LastUpdated.
TM1 REST EntitySet Annotations
delete
delete(id: string, options?: Tm1CallOptions): Promise<void>DELETE Annotations('id').
TM1 REST EntitySet Annotations
applicationContext
applicationContext(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ApplicationContextFacetValue>ApplicationContext, streamed: the facet values (expand Facet with the query). TM1 (11.8) returns none.
TM1 REST Navigation Annotation/ApplicationContext
dimensionalContext
dimensionalContext(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Member>DimensionalContext, streamed: the members of the annotated cell.
TM1 REST Navigation Annotation/DimensionalContext
attachments
attachments(id: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Attachment>Attachments, streamed: documents attached to the annotation.
TM1 REST Navigation Annotation/Attachments
cubeAnnotations
cubeAnnotations(cube: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Annotation>Cubes('c')/Annotations, streamed: a cube's annotations.
TM1 REST Navigation Cube/Annotations
cellAnnotations
cellAnnotations(cellset: string, ordinal: number, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Annotation>Cellsets('id')/Cells(n)/Annotations, streamed: one cellset cell's annotations. They also come with the cells by expand("Annotations").
TM1 REST Navigation CellsetCell/Annotations
facets
facets(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ApplicationContextFacet>GET ApplicationContextFacets, streamed, such as }Cubes (expand Values with the query).
TM1 REST EntitySet ApplicationContextFacets
facetValues
facetValues(facet: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<ApplicationContextFacetValue>A facet's Values, streamed: for }Cubes, the cubes with annotations.
TM1 REST Navigation ApplicationContextFacet/Values
facet
facet(facet: string, value: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<ApplicationContextFacet>A facet value's Facet.
TM1 REST Navigation ApplicationContextFacetValue/Facet
deleteAnnotationArtifacts
deleteAnnotationArtifacts(options?: Tm1CallOptions): Promise<void>DeleteAnnotationArtifacts: removes every annotation in the model, with their facet values, attachments and control cubes. It can't be undone.
TM1 REST ActionImport DeleteAnnotationArtifacts