Value.ViewFunction
ValueInternalCreates a view-aware wrapper around a function for use in the view infrastructure. Intended for internal use only.
Syntax
Value.ViewFunction(function as function) as functionParameters
| Name | Type | Required | Description |
|---|---|---|---|
function | function | Yes | The function to wrap for view-aware execution. |
Return Value
function — A view-aware wrapper function that integrates with the Power Query view infrastructure.
Remarks
This function is intended for internal use only and is not designed to be called directly in user-written M queries.
Value.ViewFunction is part of the Power Query view infrastructure. It wraps a function so that when the function is invoked within a view context (such as inside a Table.View handler), the engine can intercept and potentially fold the function call into the data source's native query language, or fall back to local evaluation.
The view infrastructure allows custom connectors to override how standard M operations (like filtering, sorting, or aggregating) are handled. When a connector's Table.View implementation references functions, those functions may be wrapped with Value.ViewFunction to signal to the engine that they participate in the view's query folding pipeline.
The related function Table.ViewFunction provides similar functionality specifically for table-level view operations. Value.ViewFunction is the general-purpose counterpart that works with any function, not just those operating on tables.
Key behavioral notes:
- The returned function is semantically equivalent to the input function — it produces the same results when called with the same arguments.
- The wrapping adds metadata or internal markers that the view evaluation pipeline uses to route execution.
- Calling
Value.ViewFunctionoutside of a view context has no observable effect on function behavior.
Examples
Example 1: Wrapping a simple function
let
Original = (x as number) => x * 2,
Wrapped = Value.ViewFunction(Original)
in
Wrapped(21)Result | |
|---|---|
| 1 | 42 |