Table.View
The Table.View function allows for the customization of the behavior of operations applied to a view of a table by specifying handler functions. If a table is provided, the handler functions are optio...
The Table.View function allows for the customization of the behavior of operations applied to a view of a table by specifying handler functions. If a table is provided, the handler functions are optional. However, if no table is provided, the GetType and GetRows handler functions are required. If a handler function is not specified for an operation, the default behavior of the operation will be applied to the table, except for the GetExpression operation.
Handler functions must return a value that is equivalent to the result of applying the operation to the table or view. If a handler function raises an error, the default operation behavior will be applied to the view.
Table.View can be used to enable folding to a data source, where M queries are translated into source-specific queries (e.g. creating T-SQL statements from M queries). For further details, please refer to the Power Query custom connector documentation.
Generate a simple view that does not require direct access to the rows in order to determine the row count or type.
Usage:
Power Query MTable.View(
null,
[
GetType = () => type table [CustomerID = number, Name = text, Phone = nullable text],
GetRows = () => Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]}),
GetRowCount = () => 1
])
Output:
Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]})