MemberSetService
import { MemberSetService } from "@skipcheck/tm1-client"; Member sets: the results of MDX set expressions, as a single axis of tuples, kept on
the server in /MemberSets and keyed by an ordinal TM1 assigns (1, 2, … in the
session).
Like a cellset, a member set stays until it's deleted or the session ends. TM1 (11.8)
lists none, though each reads by its ordinal: keep the ordinals execute
returns, and delete what you're done with.
Evaluate a set expression and read its members' names, deleting the set after:
// The names of Region's leaves, with the member set deleted once they're read
const withNames = ODataQuery.none().expand(CellsetAxis.Fields.Tuples, (t) => t.expand("Members", (m) => m.select(Member.Fields.Name)));
const set = await tm1.memberSets.execute("{TM1FILTERBYLEVEL({TM1SUBSETALL([Region].[Region])}, 0)}", withNames);
try {
return (set.Tuples ?? []).map((tuple) => tuple.Members![0]!.Name!);
} finally {
await tm1.memberSets.delete(set.Ordinal!);
}
Keep a set on the server to read later, by the ordinal TM1 gives it:
// Keep a large set on the server and read it later by its ordinal; TM1 doesn't list
// member sets, so hold on to the ordinal, and delete the set when done
const set = await tm1.memberSets.execute("{TM1SUBSETALL([Product].[Product])}");
return set.Ordinal!;
Members
execute | Evaluates an MDX set expression, such as {TM1SUBSETALL([Region].[Region])}, keeping the result as a member set. |
list | GET MemberSets, streamed. |
get | The set with the ordinal execute gave it, or a Tm1NotFoundException if it's gone. |
delete | Frees the set on the server. |
execute
execute(mdx: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<CellsetAxis>ExecuteMDXSetExpression: evaluates an MDX set expression, such as {TM1SUBSETALL([Region].[Region])}, keeping the result as a member set. Expand Tuples($expand=Members($select=Name)) to get its members in the same round trip. Needs schema 11.1.0. Returns the set, with the Ordinal that keys it in MemberSets.
TM1 REST ActionImport ExecuteMDXSetExpression
list
list(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<CellsetAxis>GET MemberSets, streamed. TM1 (11.8) lists none, though each reads by its ordinal with get.
TM1 REST EntitySet MemberSets
get
get(ordinal: number, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<CellsetAxis>GET MemberSets(n): the set with the ordinal execute gave it, or a Tm1NotFoundException if it's gone.
TM1 REST EntitySet MemberSets
delete
delete(ordinal: number, options?: Tm1CallOptions): Promise<void>DELETE MemberSets(n): frees the set on the server.
TM1 REST EntitySet MemberSets