AnnotationService
using Skipcheck.Tm1.Client.Services;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 (CubeAnnotationsAsync), by cell (CellAnnotationsAsync), or by ID.- An annotation's
ApplicationContextreads back empty, though the facet value given when it was made exists (FacetValuesAsync). - 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
var cell = new Dictionary<string, string>
{
["Version"] = "Forecast",
["Region"] = "North",
["Measure"] = "Amount",
};
return await tm1.Annotations.CreateAsync("Sales", cell, "Includes the March promotion");
Read a cube's comments:
// GET Annotations lists none on TM1 11.8, so read them by cube
return tm1.Annotations.CubeAnnotationsAsync("Sales").Select(annotation => $"{annotation.Creator}: {annotation.Text}");
Change what a comment says:
// TM1 keeps Text and the commentValue PAW shows apart, so change both
var text = "Includes the March and April promotions";
await tm1.Annotations.UpdateAsync(id, AnnotationPatch.Builder().Text(text).Property("commentValue", text).Build());
Members
AnnotationService constructor | A service that sends its requests through session. |
ListAsync | GET Annotations, streamed. |
GetAsync | The annotation, or a Tm1NotFoundException if there's none. |
CreateAsync | Annotates one cell, the way Planning Analytics Workspace does. |
CreateAsync | POST Annotations, for an annotation built by hand. |
UpdateAsync | PATCH Annotations('id'). |
DeleteAsync | DELETE Annotations('id'). |
ApplicationContextAsync | ApplicationContext, streamed, with Facet by expand. |
DimensionalContextAsync | DimensionalContext, streamed. |
AttachmentsAsync | Attachments, streamed. |
CubeAnnotationsAsync | Cubes('c')/Annotations, streamed. |
CellAnnotationsAsync | Cellsets('id')/Cells(n)/Annotations, streamed. |
FacetsAsync | GET ApplicationContextFacets, streamed, such as }Cubes; their Values by expand. |
FacetValuesAsync | A facet's Values, streamed. |
FacetAsync | A facet value's Facet. |
DeleteAnnotationArtifactsAsync | Removes every annotation in the model, with their facet values, attachments and control cubes. |
AnnotationService
constructorAnnotationService(Tm1Session session)A service that sends its requests through session.
ListAsync
IAsyncEnumerable<Annotation> ListAsync(ODataQuery? query = null, CancellationToken cancellationToken = default)GET Annotations, streamed. TM1 (11.8) lists none here: use
CubeAnnotationsAsync or CellAnnotationsAsync.
TM1 REST EntitySet Annotations
GetAsync
Task<Annotation> GetAsync(string id, ODataQuery? query = null, CancellationToken cancellationToken = default)GET Annotations('id'): the annotation, or a Tm1NotFoundException if there's none.
TM1 REST EntitySet Annotations
CreateAsync
Task<Annotation> CreateAsync(string cube, IReadOnlyDictionary<string, string> elements, string text, CancellationToken cancellationToken = default)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. Returns the
annotation, with its ID.
TM1 REST EntitySet Annotations
CreateAsync
Task<Annotation> CreateAsync(AnnotationPatch annotation, CancellationToken cancellationToken = default)POST Annotations, for an annotation built by hand. Returns the annotation as
made, with its ID.
TM1 REST EntitySet Annotations
UpdateAsync
Task UpdateAsync(string id, AnnotationPatch patch, CancellationToken cancellationToken = default)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
DeleteAsync
Task DeleteAsync(string id, CancellationToken cancellationToken = default)DELETE Annotations('id').
TM1 REST EntitySet Annotations
ApplicationContextAsync
IAsyncEnumerable<ApplicationContextFacetValue> ApplicationContextAsync( string id, ODataQuery? query = null, CancellationToken cancellationToken = default )ApplicationContext, streamed, with Facet by expand. TM1 (11.8) returns none.
TM1 REST Navigation Annotation/ApplicationContext
DimensionalContextAsync
IAsyncEnumerable<Member> DimensionalContextAsync(string id, ODataQuery? query = null, CancellationToken cancellationToken = default)DimensionalContext, streamed: the members of the annotated cell.
TM1 REST Navigation Annotation/DimensionalContext
AttachmentsAsync
IAsyncEnumerable<Attachment> AttachmentsAsync(string id, ODataQuery? query = null, CancellationToken cancellationToken = default)Attachments, streamed: documents attached to the annotation.
TM1 REST Navigation Annotation/Attachments
CubeAnnotationsAsync
IAsyncEnumerable<Annotation> CubeAnnotationsAsync(string cube, ODataQuery? query = null, CancellationToken cancellationToken = default)Cubes('c')/Annotations, streamed: a cube's annotations.
TM1 REST Navigation Cube/Annotations
CellAnnotationsAsync
IAsyncEnumerable<Annotation> CellAnnotationsAsync( string cellset, long ordinal, ODataQuery? query = null, CancellationToken cancellationToken = default )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
FacetsAsync
IAsyncEnumerable<ApplicationContextFacet> FacetsAsync(ODataQuery? query = null, CancellationToken cancellationToken = default)GET ApplicationContextFacets, streamed, such as }Cubes; their
Values by expand.
TM1 REST EntitySet ApplicationContextFacets
FacetValuesAsync
IAsyncEnumerable<ApplicationContextFacetValue> FacetValuesAsync( string facet, ODataQuery? query = null, CancellationToken cancellationToken = default )A facet's Values, streamed: for }Cubes, the cubes with annotations.
TM1 REST Navigation ApplicationContextFacet/Values
FacetAsync
Task<ApplicationContextFacet> FacetAsync(string facet, string value, ODataQuery? query = null, CancellationToken cancellationToken = default)A facet value's Facet.
TM1 REST Navigation ApplicationContextFacetValue/Facet
DeleteAnnotationArtifactsAsync
Task DeleteAnnotationArtifactsAsync(CancellationToken cancellationToken = default)DeleteAnnotationArtifacts: removes every annotation in the model, with their
facet values, attachments and control cubes. It can't be undone.
TM1 REST ActionImport DeleteAnnotationArtifacts