AttributeService
import { AttributeService } from "@skipcheck/tm1-client"; Attribute definitions: which attributes a kind of object has, and their types, for each
AttributeSet. Creating one adds it to every object of that kind; the values are
cells of the matching }…Attributes control cube.
Add an attribute to every element of a hierarchy:
// A text attribute on every element of the Region hierarchy
const manager = AttributeDefinitionPatch.builder().name("Manager").type(AttributeType.String).build();
return tm1.attributes.create(AttributeSet.elements("Region", "Region"), manager);
List the attributes a kind of object has, here cubes:
// The attributes that every cube has
const attributes = await tm1.attributes.list(AttributeSet.cubes(), ODataQuery.none().select(AttributeDefinition.Fields.Name)).toArray();
return attributes.map((attribute) => attribute.Name ?? "");
Members
list | GET the set's attributes, streamed. |
get | GET one attribute of the set. |
create | Adds an attribute, with its name and type, to every object of the set's kind; returns it as created. |
delete | Removes an attribute, with its values, from every object of the set's kind. |
list
list(set: AttributeSet, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<AttributeDefinition>GET the set's attributes, streamed.
get
get(set: AttributeSet, name: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<AttributeDefinition>GET one attribute of the set: its definition, or a Tm1NotFoundException if there's none.
create
create(set: AttributeSet, attribute: AttributeDefinitionPatch, options?: Tm1CallOptions): Promise<AttributeDefinition>POST: adds an attribute, with its name and type, to every object of the set's kind; returns it as created.
delete
delete(set: AttributeSet, name: string, options?: Tm1CallOptions): Promise<void>DELETE: removes an attribute, with its values, from every object of the set's kind.