Table.ViewFunction
TableCreates a view function that can be intercepted by a Table.View handler.
Syntax
Table.ViewFunction(function as function) as functionParameters
| Name | Type | Required | Description |
|---|---|---|---|
function | function | Yes | The function to wrap so it can be intercepted by a Table.View OnInvoke handler. |
Return Value
function — A wrapped function that can be handled by the OnInvoke handler in Table.View.
Remarks
Table.ViewFunction wraps a function so that it can be intercepted by the OnInvoke handler in a Table.View. This enables custom connectors to define their own foldable operations beyond the built-in set (filtering, sorting, column selection, etc.).
When the wrapped function is called on a view:
1. If the view has an OnInvoke handler and it handles the function, the handler's result is used. 2. If no OnInvoke handler exists, or it does not handle the function, or the handler raises an error, the original function is applied on top of the view as a fallback.
This function is primarily used by connector developers building advanced custom connectors. See the Power Query SDK Table.View documentation for examples.
Examples
Example 1: Define a custom foldable operation
let
TopNByColumn = Table.ViewFunction((table as table, column as text, n as number) =>
Table.FirstN(Table.Sort(table, {column, Order.Descending}), n)
)
in
TopNByColumn