Filter
using Skipcheck.Tm1.Client.OData; A $filter expression, built from ODataProperty comparisons and the
canonical functions TM1 supports:
var numericQ = Filter.And(
Filter.StartsWith(Element.Fields.Name, "Q"),
Element.Fields.Type.Eq(ODataLiterals.EnumMember("ibm.tm1.api.v1.ElementType", "Numeric"))
);
// (startswith(Name,'Q') and (Type eq ibm.tm1.api.v1.ElementType'Numeric'))
var hasRegion = Filter.Any("Hierarchies", "h", h => h.Nav("Name").Eq("Region"));
// Hierarchies/any(h:h/Name eq 'Region')
Every binary expression is parenthesized, so precedence never depends on how a filter
was composed. Values are written as OData literals (ODataLiterals.Of); the
whole expression is percent-encoded once, when the query is rendered. Raw
takes any expression as is, and is parenthesized when it's combined with others.
Note that TM1 compares names in $filter case- and space-sensitively, while
keyed access ignores both. To find one object by name, use its key rather than a
filter.
Members
Raw static | An expression written by hand, used as is. |
And static | All of the given filters, joined with and; the filter itself if there's only one. |
Or static | Any of the given filters, joined with or; the filter itself if there's only one. |
Not static | not filter. |
StartsWith static | startswith(property,'prefix'). |
EndsWith static | endswith(property,'suffix'). |
Contains static | contains(property,'text'). |
Any static | True if any member of a collection matches. |
All static | True if every member of a collection matches. |
In static | property in (a,b,c), with each value written as an OData literal. |
ToString | The filter expression, before percent-encoding. |
Equals | |
Equals | |
GetHashCode |
Raw
staticFilter Raw(string expression)An expression written by hand, used as is. Combined with others by
And or Or, it's put in parentheses, so it keeps its meaning
whatever operators it uses.
And
staticFilter And(params Filter[] filters)All of the given filters, joined with and; the filter itself if there's only
one.
Or
staticFilter Or(params Filter[] filters)Any of the given filters, joined with or; the filter itself if there's only
one.
Not
staticFilter Not(Filter filter)not filter.
StartsWith
staticFilter StartsWith(ODataProperty property, string prefix)startswith(property,'prefix').
EndsWith
staticFilter EndsWith(ODataProperty property, string suffix)endswith(property,'suffix').
Contains
staticFilter Contains(ODataProperty property, string text)contains(property,'text').
Any
staticFilter Any(string collectionPath, string variable, Func<Variable, Filter> condition)collection/any(v:condition): true if any member of a collection
matches.
Parameters
collectionPath- The path to the collection, such as
Hierarchies, used as is. variable- The range variable's name, an OData identifier.
condition- Builds the condition from the range variable
(
v.Nav("Name")).
All
staticFilter All(string collectionPath, string variable, Func<Variable, Filter> condition)collection/all(v:condition): true if every member of a collection
matches.
Parameters
collectionPath- The path to the collection, such as
Hierarchies, used as is. variable- The range variable's name, an OData identifier.
condition- Builds the condition from the range variable.
In
staticFilter In(ODataProperty property, params object?[] values)property in (a,b,c), with each value written as an OData literal. Not every
TM1 version supports in; Or of eqs always works.
ToString
string ToString()The filter expression, before percent-encoding.
Equals
bool Equals(Filter? other)Equals
bool Equals(object? obj)GetHashCode
int GetHashCode()