skipcheck

TM1 client · Docs · Reading and writing data

MemberSetService

using Skipcheck.Tm1.Client.Services;

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 ExecuteAsync 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
var set = await tm1.MemberSets.ExecuteAsync(
    "{TM1FILTERBYLEVEL({TM1SUBSETALL([Region].[Region])}, 0)}",
    ODataQuery.None().Expand(CellsetAxis.Fields.Tuples, tuples => tuples.Expand("Members", members => members.Select(Member.Fields.Name)))
);
await tm1.MemberSets.DeleteAsync(set.Ordinal!.Value);
return set.Tuples!.Select(tuple => tuple.Members![0].Name!).ToList();

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
var set = await tm1.MemberSets.ExecuteAsync("{TM1SUBSETALL([Product].[Product])}");
return set.Ordinal!.Value;

Members

MemberSetService constructorA service that sends its requests through session.
ExecuteAsyncEvaluates an MDX set expression, such as {TM1SUBSETALL([Region].[Region])}, keeping the result as a member set, with the Ordinal that keys it in MemberSets.
ListAsyncGET MemberSets, streamed.
GetAsyncThe set, or a Tm1NotFoundException if it's gone.
DeleteAsyncFrees the set on the server.

MemberSetService

constructor
MemberSetService(Tm1Session session)

A service that sends its requests through session.

ExecuteAsync

Task<CellsetAxis> ExecuteAsync(string mdx, ODataQuery? query = null, CancellationToken cancellationToken = default)

ExecuteMDXSetExpression: evaluates an MDX set expression, such as {TM1SUBSETALL([Region].[Region])}, keeping the result as a member set, with the Ordinal that keys it in MemberSets. Expand Tuples($expand=Members($select=Name)) to get its members in the same round trip. Needs schema 11.1.0.

TM1 REST ActionImport ExecuteMDXSetExpression

ListAsync

IAsyncEnumerable<CellsetAxis> ListAsync(ODataQuery? query = null, CancellationToken cancellationToken = default)

GET MemberSets, streamed. TM1 (11.8) lists none, though each reads by its ordinal with GetAsync.

TM1 REST EntitySet MemberSets

GetAsync

Task<CellsetAxis> GetAsync(int ordinal, ODataQuery? query = null, CancellationToken cancellationToken = default)

GET MemberSets(n): the set, or a Tm1NotFoundException if it's gone.

TM1 REST EntitySet MemberSets

DeleteAsync

Task DeleteAsync(int ordinal, CancellationToken cancellationToken = default)

DELETE MemberSets(n): frees the set on the server.

TM1 REST EntitySet MemberSets