# Expression

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Reference](https://developer.m-files.com/APIs/gRPC-API/Reference/index.md) > [Messages](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.Expression/

Expression that can be evaluated for any object.

Set `type` and the member of `data` that matches it, for example `EXPRESSION_TYPE_PROPERTY_VALUE`
with `data.property_value`.

Indirection levels evaluate a property of a related object. For example, documents whose
project's customer is a given customer: a property value expression for the Customer property,
with one indirection level for the Project property. The levels are listed from the searched
object outwards. Indirection works with property value, typed value and document ID segment
expressions, and with the `STATUS_TYPE_OBJECT_ID` status value; other expressions with
indirection levels fail with "Invalid search condition."

- **Full name:** `MFiles.Expression`
- **Proto file:** [`mfiles/structs.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/structs.proto)

<a id="fields"></a>

## Fields

| Field | Type | Number | Description |
|---|---|---|---|
| <a id="f-type"></a>`type` | [`ExpressionType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.ExpressionType/index.md) | 1 | The kind of expression. Must match the member set in `data`. Values: `EXPRESSION_TYPE_UNINITIALIZED` (0), `EXPRESSION_TYPE_PROPERTY_VALUE` (1), `EXPRESSION_TYPE_ID_SEGMENT` (2), `EXPRESSION_TYPE_STATUS_VALUE` (3), `EXPRESSION_TYPE_FILE_VALUE` (4), `EXPRESSION_TYPE_TYPED_VALUE` (5), `EXPRESSION_TYPE_ANY_FIELD` (6), `EXPRESSION_TYPE_PERMISSIONS` (7). |
| <a id="f-data"></a>`data` | [`ExpressionUnion`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ExpressionUnion/index.md) | 2 | The expression data. Set the member that matches `type`. |
| <a id="f-indirection_levels"></a>`indirection_levels` | repeated [`IndirectionLevel`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.IndirectionLevel/index.md) | 3 | The lookups to follow before evaluating the expression, from the searched object outwards. Empty evaluates the expression on the object itself. |

<a id="used-by-methods"></a>

## Used by methods

- [IRPCSearch.GetFacetValues](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFacetValues/index.md): Retrieves the facet values for the documents that satisfy the specified search conditions.

<a id="used-in-fields"></a>

## Used in fields

- [`GroupingLevel.expression`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.GroupingLevel/index.md#f-expression): Basic data.
- [`SearchCondition.expression`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.SearchCondition/index.md#f-expression): The left side of the condition: what is evaluated for each object, such as a property value, a status value or any field (full-text search).
- [`GetFacetValuesRequest.facets_requested`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCSearch/GetFacetValues/index.md#request): The facets to compute, as expressions; for example an `EXPRESSION_TYPE_PROPERTY_VALUE` expression for property 100 (Class).
