skipcheck

TM1 client · Docs · Queries

ODataQuery

using Skipcheck.Tm1.Client.OData;

Used in the walkthroughs Connect and list your cubes, Read and write cells, Run a process and read its result, Test your code against a real TM1, Add TM1 to a Spring Boot application.

OData query options: $select, $expand (with nested options), $filter, $orderby, $top, $skip, $count, custom options such as TM1's !sandbox, and parameter aliases. Immutable: each method returns a new query.

var query = ODataQuery
    .None()
    .Select("Name", "Type")
    .Expand("Hierarchies", h => h.Select("Name").Top(5))
    .Filter(Filter.StartsWith(ODataProperty.Of("Name"), "Q"))
    .ToQueryString();
// $select=Name,Type&$expand=Hierarchies($select=Name;$top=5)&$filter=startswith(Name,'Q'), each value encoded

Options are written in a fixed order, lowercase with $ as OData 4.0 requires, and each value is percent-encoded once by ToQueryString. Nested options inside $expand are separated by ;.

Members

None staticNo options.
SelectAdds property paths to $select, after any already selected.
SelectAdds properties to $select, after any already selected.
ExpandExpands a navigation property with no nested options.
ExpandExpands a navigation property, with nested options applied to what's there for it already.
ExpandExpands a navigation property with no nested options.
ExpandExpands a navigation property, with nested options.
FilterSets $filter, replacing any set before.
OrderByAdds an ascending $orderby key, after any keys already added.
OrderByDescendingAdds a descending $orderby key, after any keys already added.
OrderByAdds an ascending $orderby key.
OrderByDescendingAdds a descending $orderby key, after any keys already added.
TopSets $top.
SkipSets $skip.
WithCountSets $count=true.
OptionA custom option, such as TM1's !sandbox.
OptionThe value of a custom option, or null.
AliasA parameter alias's value.
IsEmptyTrue if this query has no options.
ParametersEvery option, unencoded, in order.
ToQueryStringThe encoded query string, without ?.
ToStringThe query string, before percent-encoding, for logs.
Equals
Equals
GetHashCode

None

static
ODataQuery None()

No options: the server's default response.

Select

ODataQuery Select(params string[] properties)

Adds property paths to $select, after any already selected. Like every option here it works the same at the top level and inside Expand.

Select

ODataQuery Select(params ODataProperty[] properties)

Adds properties to $select, after any already selected.

Expand

ODataQuery Expand(string navigation)

Expands a navigation property with no nested options.

Expand

ODataQuery Expand(string navigation, Func<ODataQuery, ODataQuery> options)

Expands a navigation property, with nested options applied to what's there for it already.

Expand

ODataQuery Expand(ODataProperty navigation)

Expands a navigation property with no nested options: Expand(Cube.Fields.Dimensions).

Expand

ODataQuery Expand(ODataProperty navigation, Func<ODataQuery, ODataQuery> options)

Expands a navigation property, with nested options: Expand(Dimension.Fields.Hierarchies, h => h.Select(Hierarchy.Fields.Name)).

Filter

ODataQuery Filter(Filter filter)

Sets $filter, replacing any set before.

OrderBy

ODataQuery OrderBy(string property)

Adds an ascending $orderby key, after any keys already added.

OrderByDescending

ODataQuery OrderByDescending(string property)

Adds a descending $orderby key, after any keys already added.

OrderBy

ODataQuery OrderBy(ODataProperty property)

Adds an ascending $orderby key: OrderBy(Element.Fields.Name).

OrderByDescending

ODataQuery OrderByDescending(ODataProperty property)

Adds a descending $orderby key, after any keys already added.

Top

ODataQuery Top(int n)

Sets $top: at most this many items.

Throws

ArgumentException
n is negative.

Skip

ODataQuery Skip(int n)

Sets $skip: skip this many items first.

Throws

ArgumentException
n is negative.

WithCount

ODataQuery WithCount()

Sets $count=true: include the total number of matching items.

Option

ODataQuery Option(string name, string value)

A custom option, such as TM1's !sandbox.

Option

string? Option(string name)

The value of a custom option, or null.

Alias

ODataQuery Alias(ODataPath.Alias alias, string literalOrJson)

A parameter alias's value: Fn(p=@p) with ?@p=….

IsEmpty

bool IsEmpty()

True if this query has no options.

Parameters

IReadOnlyList<KeyValuePair<string, string>> Parameters()

Every option, unencoded, in order.

ToQueryString

string ToQueryString()

The encoded query string, without ?.

ToString

string ToString()

The query string, before percent-encoding, for logs.

Equals

bool Equals(ODataQuery? other)

Equals

bool Equals(object? obj)

GetHashCode

int GetHashCode()